Discussion :: Java.lang Class
-
What will be the output of the program?
String a = "newspaper"; a = a.substring(5,7); char b = a.charAt(1); a = a + b; System.out.println(a);
Answer : Option B
Explanation :
Both substring() and charAt() methods are indexed with a zero-base, and substring() returns a String of length arg2 - arg1.
Be The First To Comment