Java Question About Default and Defined Constructors
What will happen when the following code is executed? |
public class MyClass { public MyClass(int number) { System.out.println(number); } public static void main(String [] args) { MyClass my1 = new MyClass(); MyClass my2 = new MyClass(100); } } |
A. 100 will be printed out. B. A blank line, then 100 will be printed out. C. Nothing will be printed out. D. The code does not compile. |
Bookmark:
Search for code examples on this site
