What is the output of the following code?
String s = "Hello World";
System.out.println(s.substring(6));
Loading test…
12 questions
What is the output of the following code?
String s = "Hello World";
System.out.println(s.substring(6));
What is the output of the following code?
String s = null;
System.out.println(s.length());
What is the output of the following code?
String s = "Hello, World!";
System.out.println(s.length());
What is the output of the following code?
String s = "Java";
s = s.toUpperCase();
s = s + " rocks";
System.out.println(s);
What is the value of result after this code executes?
double result = Math.sqrt(Math.pow(3.0, 2) + Math.pow(4.0, 2));
What does the following code print?
String s = "programming";
System.out.println(s.substring(3, 7));
What is the output of the following code?
System.out.println(Math.abs(-7));
System.out.println(Math.pow(2, 3));
What is the output of the following code?
Integer a = 127;
Integer b = 127;
Integer c = 200;
Integer d = 200;
System.out.println(a == b);
System.out.println(c == d);
Which of the following correctly compares two String objects for equal content in Java?
String a = "hello";
String b = "hello";
What is printed by the following code?
String s = " hello ";
System.out.println(s.trim().toUpperCase().length());
What is the output of the following code?
String s = "abcdef";
System.out.println(s.indexOf("cd"));
System.out.println(s.indexOf("xy"));
What is the value of n after the following code executes?
int n = (int)(Math.random() * 6) + 1;