Ans is wrong for the below questions :-
1) public class Test {
int i;
int j;
public static void main(String[] args) {
Test t1 = new Test();
t1.i=200;
t1.j=100;
add(t1);
System.out.print(t1.i);
System.out.print(t1.j);
}
public static void add(Test t) {
t.i=t.i+100;
t.j=t.j+100;
System.out.print(t.i);
System.out.print(t.j);
}
2) public class Test {
int i;
public static void main(String[] args) {
Test t1 = new Test();
t1.i=100;
Test t2 = new Test();
t2.i=200;
Test t3 = new Test();
t3.i=300;
t1=t3;
t3.i=200+t1.i;
System.out.println(t1.i);
t3= new Test();
t2=t3;
System.out.print(t2.i);
}
}
3)
public class Test {
public static void main(String[] args) {
if(true && false && true || false)
System.out.println("True.");
else
System.out.println("False");
}
}
4) public class Test {
public static void main(String[] args) {
System.out.println("A");
System.out.print("B");
System.out.print("C");
System.out.println("D");
System.out.println("E");
}
}
So can you please look at the exercises and update it with the proper answers as its creating confusion.
Instructor
Ashish Thakur Replied on 20/06/2019
Thanks for the report. We are looking into it. Will resolve the issue soon.