Java Fundamentals
Decision Structures
Loops and More
Methods
Classes
100

How do you make multi-line comments?

/* */

100

A boolean variable that signals when
some condition exists in the program.

A flag

100

A while loop has what type of test?

Pre-test

100

What are the method modifiers?

Public and Static

100

What is a no-arg constructor?

A special method  used to initialize an object in a default configuration. 

200

When associated with the class header, they define the scope of the class.

When associated with a method, they define the scope of the method.

Curly Braces

200

Provide Logical Operators

||, &&, !

200

Given the following code, what type of loop is this?

int x = 5;

while(x > 0)

{

System.out.println("x is greater than 0");

x ++;

}

Infinite Loops

200

What is the variable that holds the value being passed into a
method?

Parameter

200

What is it called when two or more methods in a class may have the
same name as long as their parameter lists are different. (method’s signature) 

Method Overloading

300

What is the escape sequence for newline?

\n

300

Give name1 and name2 are initialized. How do we check if they are truly the same name? (Write the code and tell me what it returns)

name1.equals(name2);

boolean value is returned.

300

What is needed in the parenthesis of a for loop?

Initialization, test, update

300

What is the statement
causes the method to end
execution and it returns a
value back to the
statement that called the
method 

Return Statement

300

What is the key word not used when creating methods in a non-driver class?

static

400

What can the + operator do (hint: 2 things)?

Can be a concatenation operator with string and act as a regular operator with numbers.

400

What is the decision structure that lets the value of a variable or expression determine where the program will branch to?

Switch Statement

400

Say that a Random Object is created.

Create a random number between 5-10.

int number = random.nextInt(6) + 5;

400

Will there be compiler errors if there is widening conversion?

No

400

The data type of an argument must be the same as the variable declaration in the parentheses of the method declaration. True or false

True

500
How do you declare an int variable?

int num;

500

What will this print?

int num = 0;

if(num >1){

System.out.println("a");

} num++;

else if(num >0){ System.out.println("b");}

num--;

else{ System.out.println("c");

}

System.out.println("d");

Error! You must immediately follow up with else if to continue the if-else-if statement. What would print if we got rid of num++ and num--;

500

What is something that can be used to notify the program to stop acquiring input.

Sentinel Value

500

When passing an object, what is passed?

The reference to the object is passed.

500

A variable associated with an object is called what?

Reference variable