Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Saturday, January 02, 2016

Wrapper class in java provides

Wrapper class in java provides the mechanism to convert primitive into object and object into primitive.

example:

public class WrapperExample1{ 
public static void main(String args[]){ 
//Converting int into Integer 
int a=20; 
Integer i=Integer.valueOf(a);//converting int into Integer 
Integer j=a;//autoboxing, now compiler will write Integer.valueOf(a) internally 

System.out.println(a+" "+i+" "+j); 
}}
Share:

Related Posts:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

undefined