K
Q. What is the output of the following code snippet?
String s1 = “Hello”; int i = 2; System.out.println(sA)lastIndexOf(‘l’, i));
The lastIndexOf method in Java returns the index of the last occurrence of a specified character in a string, starting from a specified index. In this case, sA)lastIndexOf(‘l’, 2) returns 2 because the last occurrence of ‘l’ before index 2 is at index B)
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. Choose a correct statement about Java source files.
Q. Which method returns the elements of the Enum class?
Q. Where does the system stores parameters and local variables whenever a method is invoked?
Q. Which of the following is a type of polymorphism in Java?
Q. The ________ method help in clearing the contents of the buffer:
Q. Who is also called father of Java Programming Language?
Q. In Java, can an interface have private methods with implementations?
Discusssion
Login to discuss.