3rd Six Weeks Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Math methods

A
  • Math.ceil( ): The Math.ceil(x) function returns the smallest integer greater than or equal to a number “x”.
  • Math.floor( ): The Math.floor(x) function returns the largest integer less than or equal to a number “x”.
  • Math.round( ): The Math.round() function returns the value of a number rounded to the nearest integer.
  • Math.min( ): The min() method returns the number with the lowest value.
  • Math.max( ): The max() method returns the number with the highest value.
  • Math.sqrt( ): The sqrt() method returns the square root of a number
  • Math.pow( ): The pow() method returns the value of x to the power of y (xy).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

String class

A

s1. equals( “hi”)
s1. substring(5)
s1. substring( 2,7)
s1. charAt(3)
s1. indexOf(“a”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Scanner methods

A
next( )
nextInt( ): when working with an integer
nextDouble( ): when working with a double
nextLine( )
hasNext( )

The next() and hasNext() methods and their primitive-type companion methods (such as nextInt() and hasNextInt()) first skip any input that matches the delimiter pattern, and then attempt to return the next token. Both hasNext and next methods may block waiting for further input. Whether a hasNext method blocks has no connection to whether or not its associated next method will block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

while loop

A

A while loop is a control structure that allows you to repeat a task a certain number of times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

do…while loop

A

A do…while loop is similar to a while loop, except that a do…while loop is guaranteed to execute at least one time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

for Loop

A

A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.
A for loop is useful when you know how many times a task is to be repeated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly