Explore topic-wise MCQs in Java Dot lang Class General Questions.

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

1.

 public class Myfile { public static void main (String[] args) { String biz = args[1]; String baz = args[2]; String rip = args[3]; System.out.println("Arg is " + rip); } }
Select how you would start the program to cause it to print: Arg is 2

A. java Myfile 222
B. java Myfile 1 2 2 3 4
C. java Myfile 1 3 2 2
D. java Myfile 0 1 2 3
Answer» D. java Myfile 0 1 2 3
2.

Which of the following are valid calls to Math.max?

1.Math.max(1,4)

2.Math.max(2.3, 5)

3.Math.max(1, 3, 5, 7)

4.Math.max(-1.5, -2.8f)

A. 1, 2 and 4
B. 2, 3 and 4
C. 1, 2 and 3
D. 3 and 4
Answer» B. 2, 3 and 4
3.

What is the value of "d" after this line of code has been executed?

double d = Math.round ( 2.5 + Math.random() );

A. 2
B. 3
C. 4
D. 2.5
Answer» C. 4