Java practice questions UPDATED ACTUAL Exam Questions and
CORRECT Answers
The JDK command to compile a class in the file Test.java is - javac Test.java
Which JDK command is correct to run a Java application in ByteCode.class? - java
ByteCode.class
Java compiler translates Java source code into ____ - A. Java bytecode
_____ is a software that interprets Java bytecode - Java virtual machine
Suppose you define a Java class as follows:
public class Test {
}
In order to compile this program, the source code should be stored in a file named - Test.java
The extension name of a Java bytecode file is - .class
The extension name of a Java source code file is - .java
Which of the following lines is not a Java comment?
A. /** comments */
, B. // comments
C. -- comments
D. /* comments */
E. ** comments ** - -- comments
** comments **
the following are the reserved words: - A. public
B. static
C. void
D. class
Every statement in Java ends with ___ - a semicolon (;)
A block is enclosed inside __________. - braces
The __________ method displays a message dialog box -
JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2 Output",
JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "Welcome to Java!");
To use JOptionPane in your program, you may import it using: - import
javax.swing.JOptionPane;
import javax.swing.*;
Programming style is important, because __________ - good programming style makes a
program more readable
CORRECT Answers
The JDK command to compile a class in the file Test.java is - javac Test.java
Which JDK command is correct to run a Java application in ByteCode.class? - java
ByteCode.class
Java compiler translates Java source code into ____ - A. Java bytecode
_____ is a software that interprets Java bytecode - Java virtual machine
Suppose you define a Java class as follows:
public class Test {
}
In order to compile this program, the source code should be stored in a file named - Test.java
The extension name of a Java bytecode file is - .class
The extension name of a Java source code file is - .java
Which of the following lines is not a Java comment?
A. /** comments */
, B. // comments
C. -- comments
D. /* comments */
E. ** comments ** - -- comments
** comments **
the following are the reserved words: - A. public
B. static
C. void
D. class
Every statement in Java ends with ___ - a semicolon (;)
A block is enclosed inside __________. - braces
The __________ method displays a message dialog box -
JOptionPane.showMessageDialog(null, "Welcome to Java!", "Example 1.2 Output",
JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "Welcome to Java!");
To use JOptionPane in your program, you may import it using: - import
javax.swing.JOptionPane;
import javax.swing.*;
Programming style is important, because __________ - good programming style makes a
program more readable