This section of our 1000+ Java MCQs focuses on string handling in Java Programming Language. 1. Which of these class is superclass of String and StringBuffer class? Answer: b 2. Which of
these operators can be used to concatenate two or more String objects? Answer: a 3. Which of this method of class String is used to obtain a length of String object? Answer: d 4. Which of these method of class String is used to extract a single character from a String object? Answer:
c 5. Which of these constructors is used to create an empty String object? Answer: a 6. Which of these is an incorrect statement? Answer: c 7. What will be the output of the following Java program?
a) a Answer: d $ javac String_demo.java
$ java String_demo
abc 8. What will be the output of the following Java program?
a) ABC Answer: b $ javac String_demo.java
$ java String_demo
BCD 9. What will be the output of the following Java program?
a) 3 0 Answer: d $ javac String_demo.java $ java String_demo 4 3 Sanfoundry Global Education & Learning Series – Java Programming Language. Next Steps:
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn. Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses. |