Home

Java Programming MCQ Question with Answer

Java Programming MCQ with detailed explanation for interview, entrance and competitive exams. Explanation are given for understanding.

Download Java Programming MCQ Question Answer PDF

Question No : 22
Which of the following are the wrapper classes?

Random
Vector
Byte
all of the above

Question No : 23
Which of the following methods belong to the String class?

length()
compareTo()
substring()
all of the them

Question No : 24
Given the code
String s = new String("abc");
Which of the following calls are valid?

s.toUpperCase()
s.append("xyz")
s.setCharAt(1<'A')
all of the above

Question No : 25
The methods wait() and noify() are defined in

java.lang.Thread
java.lang.Runnable
java.lang.Object
java.lang.ThreadGroup

Question No : 26
When we invoke repaint () for a Component, the AWT invokes the method:

draw()
update()
show()
paint()

Question No : 27
What does the following line of code do?
TextField text=new TextField(10);

Creates text object that can hold 10 rows of text.
Creates text object that can hold 10 columns of text.
Creates the object text and initializes it with the value 10.
The code is illegal.

Question No : 28
Which of the following methods can be used to draw the outline of a square?

fillRect()
drawLine()
drawString()
all of the above