Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
Java Programming
»
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);
apa
app
apea
apep
Show Answer
Correct Answer:
app
Explanation:
Both
substring()
and
charAt()
methods are indexed with a zero-base, and
substring()
returns a String of length
arg2 - arg1
.
← Previous
Next →
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment