Explore topic-wise MCQs in Java.

This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.

1.

ONE?$

A. two
B. one two
C. compilation error
Answer» D.
2.

What is the value returned by function compareTo() if the invoking string is greater than the string compared?

A. zero
B. value less than zero
C. value greater than zero
D. none of the mentioned
Answer» B. value less than zero
3.

Which of this method of class String is used to extract a substring from a String object?

A. substring()
B. Substring()
C. SubString()
D. None of the mentioned
Answer» B. Substring()