True or False: A benefit of using an IDE is your code complies and runs faster.
false
What does the following statement do in a Java application?
import java.util.Scanner;
It makes the Scanner class available to the application without qualification.
In a while loop, the Boolean expression is tested when?
before the loop is executed
To join (or concatenate) one string with another string or another data type, you can use the ________________ operator.
+
The array that follows is an array of
double[] grades = new double[3];
double values
Java's syntax is similar to the syntax of what language(s)?
C++ and C#
You can use the nextLine method of the Scanner object to do what?
return all text on the current line as a String object
You can use a logical operator to do what?
combine two Boolean expressions
determine if two expressions are equal
To append a string or another data type to a string, you can use the ________________ operator.
+=
What is the value of names[4] in the following array?
String[] names = {"Jeff", "Dan", "Sally", "Jill", "Allie"};
Allie
Packages
A Boolean expression is an expression that returns a ________________ value.
True or False
The difference between a if/else and a switch statements is what?
It can’t perform an operation based on the result of a Boolean expression
You can use the final keyword to do what?
to prevent a class from being inherited
to prevent a method from being overridden
to prevent a method from assigning a new value to a parameter
To refer to an element in an array you use a/an ____________.
index
One of the primary benefits of a typical IDE for Java is that it checks the ________________ of your code as you enter it so you make fewer entry errors.
Syntax
When you use a constructor to create an object from a Java class, you are creating a/an ________________ of the class.
How many lines are printed on the console when the following for loop is executed?
for (int i = 2; i < 10; i++) {
System.out.println(i);
}
8
What keyword do you use in a class declaration to create a subclass?
extends
Which of the following is a difference between arrays and collections?
Collections can grow in size, but arrays can’t.
Arrays can store unwrapped primitive types, but collections can’t.
Collections are created from classes, but arrays aren’t.
The Java compiler takes the source code for an application and translates it into ______.
bytecodes
You call a/an ________________ from an object.
method
What is the value of x after the following statements are executed?
int x = 5;
switch(x) {
case 5:
x += 2;
break;
case 6:
x++;
break;
default:
x *= 2;
break;
}
7
What class or classes is a variable available to if it is declared without an access modifier?
All classes in the same package
What is the value of m after the code that follows is executed?
ArrayList<Double> miles = new ArrayList<>();
miles.add(37.5);
miles.add(26.2);
miles.add(54.7);
double m = miles.remove(0);
37.5