Imagine there is a class Employee. We create an object of EmployeeEmployee a= New Employee();If we are givingSystem.out.println(a);What gets printed?

Questions by Rajseek

Showing Answers 1 - 8 of 8 Answers

sudharson.R

  • Feb 8th, 2006
 

Simple.

It will print some junk values.

  Was this answer useful?  Yes

sanjib107

  • Feb 8th, 2006
 

It gives the memory location.

Ex:-

public class Employee{
        public static void main(String ags[]){
                Employee a=new Employee();
                System.out.println("See Result:"+a);
        }
}

O/P:-

See Result:Employee@a16869

  Was this answer useful?  Yes

dgshivas

  • Feb 25th, 2008
 

If we try to print instance of a class,toString() method gives the out put of hashcode.

First if prints the possible appropriate class name followed by @ symbole and hashcode of the class instance.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions