'Why object is not null in below java code? [duplicate]
In below code the answer is "kjl". here the object is assigned to null. Why object is not null here?
public class Main
{
public static void main(String[] args) {
test tr =new test();
tr.display(tr);
System.out.println(tr.Name);
}
}
class test {
String Name = "abc";
void display(test t) {
t.Name = "kjl";
t = null;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
