- #1
tking88
- 2
- 0
What is Instance, Empty Constructor ... in Java
How come will return false I put in 2 same name it should return true ?
it print out
I do testing on below it give me ture how come the above not give me true
How come will return false I put in 2 same name it should return true ?
Code:
Teacher p1= new Teacher("Nelson");
System.out.println(p1);
Teacher p2= new Teacher("Nelson");
System.out.println(p2);
System.out.println(p1.equals(p2));
it print out
Code:
false
I do testing on below it give me ture how come the above not give me true
Code:
p1 = "Nelson";
p2 = "Nelson";
System.out.println(p1.equals(p2));
Last edited: