Why is it like this?
Codes:
public class Class1 {
Class1 c1
public Class1() { c1 = null; }
}
public class Class2 {
public static void main(String[] args) {
Class1 cs1 = new Class1();
System.out.println(cs1 == null);
}
}
In Class1 I initialized the c1 as null in its contructor. Then
when I instantiated the Class1 in Class2 then check if its value is really null (cs1 == null) the output it produces is false.
Why does it output as false? cs1 is null, hence it's supposed to print as true. Why does this happen? Can someone please explain this to me? Thanks...