Question 1
Each Java class must contain a main method.
◦ true
◦ false
Question 2
Analyze the following code:
class Test {
public static void main(String[] args) {
| System.out.println(xMethod((double)5)); |
}
public static int xMethod(int n) {
| System.out.println("int"); |
}
public static long xMethod(long n) {
| System.out.println("long"); |
}
}
◦ The program runs fine but displays things other than 5.
◦ The program displays long followed by 5.
◦ The program does not compile.
◦ The program displays int followed by 5.