public class Util {
public static int doubleIt(int n) { return n * 2; }
}
// ...
Util u = new Util();
System.out.println(u.doubleIt(7));What is printed?
- Acheck_circle
14
- B
7
- C
Compile-time error
- D
0
Explanation
Although calling a static method through an instance is discouraged, it compiles; the method returns 14.