Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld
- {
- public static void main(String[] args)
- {
- Test test = new Test();
- test.setA( test.a );
- if( test.a==null){
- System.out.println("a is null ");
- } else {
- System.out.println("a is not null ");
- }
- }
- }
- public class A{
- }
- public class Test{
- A a; //use this and a is null
- //A a = new A(); //use this and a is not null
- void setA(A a){
- a = new A();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment