Question: Analyze the following code of the two classes called, Test1 and Test2: ublic class Test1 public static void main(Stringl args) Test2 a - new Test20:

Analyze the following code of the two classes called, Test1 and Test2: ublic class Test1 public static void main(Stringl args) Test2 a - new Test20: a.print0; ublic class Test2 public String s public Test2(String s) this.s-s public void print0 System.out.printin(s): The program Test compiles and runs fine and prints nothing. The program Test1 would compile and run if you change Test2 a-new Test20 to Test2 a - new Test2("5") The program Test1 will print the value of string s The program will compile only if you make the String s private
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
