Java Lang Package
Java Lang Package
packag
e
What is objects class?
For any java object whether it is
predefine or customized the most
commonly required methods are
encapsulated into a separate class which
is nothing but object class.
Method present in objects class?
Public string toString()
1. We can use this method to get string representation
of an object.
2. Whenever we are try to print any object reference
{
public static void main(String[] args)
{
Integer i=Integer.valueOf("10");
System.out.println(i);//10
System.out.println(i.toString());//10
} }
Autoboxing and Autounboxing
(1.5v)
Until 1.4 version we can't provide wrapper
object in the place of primitive and primitive
in the place of wrapper object all the
required conversions should be performed
explicitly by the programmer.
class AutoBoxingAndUnboxingDemo
{
public static void main(String[] args)
{
Boolean b=new Boolean(true);
if(b)
{
System.out.println("hello");
}
}
}
Output: hello
Output: hello
Autoboxing :
Autounboxing :