Thursday, 12 March 2015

Object Class - System Class

·         System is a class available in java.lang package
·         Java.lang package is imported to every java class by default, hence no need to import explicitly
·         System class contains 2 Static reference variable, which are:
(1)    in-is type of input stream
(2)    out-is type of print stream
·         print stream object contains several methods used to print characters on the standard output device or monitor
·         input stream contains members or methods used to read from standard input device
·         Object class is super most class in java where every class has to inherit members of object class. This class is available in package java.lang
·         The toString() of object class is public method of return type String, whenever this method is invoked, the method returns String representation of object
·         The String representation of an object will be displayed in following format:
“fullyqualifiedclassname@hexadecimaladdress”
Whenever reference variable is printed, the toString() is implicitly invoked. Hence, the return value of toString() is displayed

·         A class can override toString() of object class. I such class the object will be override in the implementation class and the original implementation will be lost

No comments:

Post a Comment