What is the difference between Anonymous object and Named object? Give example with code.
We generally use anonymous object when there is just a one time use of a particular object but in case of a repeated use we generally used named objects and use that named reference to use that objects again and again.
Named
– String s = “hello”; System.out.println(s);
– “hello” has a named reference s.
Anonymous
– System.out.println(“hello”);
Named
– String s = “hello”; System.out.println(s);
– “hello” has a named reference s.
Anonymous
– System.out.println(“hello”);
Difference Anonymous object and Named object?
Reviewed by MCH
on
April 28, 2014
Rating:
No comments: