Suppose the String s is declared and initialized as follows: String s = "elementary"; What String would be returned by the method call s.substring(1, 4);?
lem
What will be printed by the following code? String s = "Animal"; System.out.println(s.indexOf("al"));
4
Suppose s1 and s2 are Strings and the following code is run: s1 = s1.toLowerCase(); s2 = s1.toUpperCase(); System.out.println(s1.compareTo(s2)); What should be the expected output?
A positive value is printed
Which of the following correctly declares a new variable which can be used to point to an object of the double class type?
double d;
Which of the following best describes the relationship between a class and an object?
Objects are created using classes, which are similar to blueprints.
Select all the classes from the list
Scanner String
Which code shows us creating an object of data type Scanner class and storing it with a variable named stat ?
Scanner stat = new Scanner(System.in);
How would you make int a class?
Use Integer
What will be printed by the following code? String s = "Tiny"; System.out.println(s.indexOf("n"));
2
Suppose the String s is declared and initialized as follows: String s = "middle"; What String would be returned by the method call s.substring(3, 4);?
d