Wednesday, 14 October 2015

Wrapper Class examples in java

import java.io.*;

public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
Byte obj = new Byte((byte) 10);
Byte obj1 = new Byte("10");
Character obj2= new Character('A');
byte j=obj1.byteValue();
byte i=obj.byteValue();
int k = obj.compareTo(obj1);
System.out.println("The value of K is " +k);
System.out.println("The value of i is " +i);
System.out.println("The value of j is " +j);
char ch = obj2.charValue();
System.out.println("The value of char is " +ch);
Character obj3 = Character.valueOf(ch);
System.out.println("The value of char is " +obj3);


}
}


output:-
The value of K is 0
The value of i is 10
The value of j is 10
The value of char is A
The value of char is A

No comments:

Post a Comment