Given the following statements:
1
2
String total = "five" + "seven";
System.out.println(total);
What is displayed to the screen?
fiveseven
Given the following code:
1
2
String greeting = "Hello There!";
System.out.println(greeting.length());
What is displayed to the screen?
12
Given the following code:
1
2
String line = "I love lamp.");
System.out.println(line.indexOf("lamp"));
What is displayed to the screen?
7
Given the following code:
1
System.out.println("You had me at \"hello\".");
What is displayed to the screen?
You had me at "hello".
Given the following code:
1
2
3
4
System.out.print("One");
System.out.println("Two");
System.out.print("Three");
System.out.println("Four");
What is displayed to the screen?
1 2 OneTwo ThreeFour
Given the following declarations:
1
2
Scanner keyboard = new Scanner(System.in);
String word;
Which of the following reads a single words in to the variable word?
word = keyboard.next();
Which of the following is used to display formatted output?
System.out.printf
Which of the following would be the best name for a variable representing the distance between two points?
distanceBetweenPoint
Which of the following is a correct multi-line comment?
1 2 3 4/* This is the first line This is the second line */
Which of the following class definitions is correctly indented?
1 2 3 4 5 6 7 8 public class StyleExample { public static void main(String[] args) { System.out.println("This is an example of good"); System.out.println("programming style"); } }