Question 4: Examine the following content of Java source code file Multiple.java and select the correct
options:
// Contents of Multiple.java
public interface Printable {
//.. we are not detailing this part
}
interface Movable {
//.. we are not detailing this part
}
C. A Java source code file can define multiple interfaces and classes.
Question 5: Examine the content of the following Java source code file, Multiple2.java, and select the correct
option(s):
// contents of Multiple2.java
interface Printable {
//.. we are not detailing this part
}
class MyClass {
//.. we are not detailing this part
}
interface Movable {
//.. we are not detailing this part
}
public class Car {
//.. we are not detailing this part
}
public interface Multiple2 {}
Question 6: What is the result of the following class? (Choose all that apply)
1: public class _C {
2: private static int $;
3: public static void main(String[] main) {
4: String a_b;
5: System.out.print($);
6: System.out.print(a_b);
7: } }
Question 8: The following piece of code doesn’t compile. Fix it to compile it.
public class ImportExample {
public static void main(String[] args) {
Random r = new Random();
System.out.println(r.nextInt(10));
}
}
Question 9: In the following code, how many of the imports do you think are redundant?
1: import java.lang.System;
2: import java.lang.*;
3: import java.util.Random;
4: import java.util.*;
5: public class ImportExample {
6: public static void main(String[] args) {
7: Random r = new Random();
8: System.out.println(r.nextInt(10));
9: }
10: }