\wrapper

Ads
 

\wrapper

Hands on Exercise on Wrapper Class:

Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer to integer displays the largest and smallest values of type integer converts the decimal to binary and hexadecimal

expected output: String s = 26 Integer m = 26 String s = 26 String x = 6 integer m = 26 Integer.MIN_VALUE = -2147483648 Integer.MAX_VALUE = 2147483647 Binary: 11010 Hexadecimal: 1a

View Answers

January 27, 2011 at 12:29 PM

Hi Friend,

Try this:

class ConversionExample
{
    public static void main(String[] args) 
    {
     int i=26;
     Integer integer=new Integer(i);
     String st=integer.toString();
     int no=Integer.parseInt(st);
     String str=Integer.toString(no);
     Integer num=Integer.valueOf(str);
     int in=num.intValue();
     System.out.println("int to Integer= "+integer);
     System.out.println("Integer to String= "+st);
     System.out.println("String to int= "+no);
     System.out.println("int to String= "+str);
     System.out.println("Integer to String= "+st);
     System.out.println("String to Integer= "+num);
     System.out.println("Integer to int= "+in);
     int max=Integer.MAX_VALUE;
     int min=Integer.MIN_VALUE;
     System.out.println("Minimum value of integer: "+min);
     System.out.println("Maximum value of integer: "+max);
     System.out.println("Binary: "+Integer.toBinaryString(in));
     System.out.println("Hexadecimal: "+Integer.toHexString(in));

    }
}

Thanks

Ads









Related Tutorials/Questions & Answers:
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
Advertisements
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
Version of wrapper>wrapper dependency
List of Version of wrapper>wrapper dependency
wrapper class
wrapper class  list wrapper class methods
wrapper class
wrapper class  wrapper class methods
wrapper class
wrapper class  why wrapper class does not have a default constructor
wrapper classes
wrapper classes  Explain wrapper classes and their use?   Java Wrapper Class Wrapper class is a wrapper around a primitive data type... of the primitive wrapper classes in Java are immutable i.e. once assigned a value
Wrapper Class
Wrapper Class  what is wrapper class in java and why we use it   Hi Friend, Wrapper class is a wrapper around a primitive data type... of the primitive wrapper classes in Java are immutable i.e. once assigned a value to a wrapper
Wrapper
Wrapper       Java provides wrapper classes corresponding to each primitive data types in its "... utility methods to manipulate the values. All of the primitive wrapper classes
Artifacts of wrapper
List of Artifacts of wrapper maven depenency
wrapper class.
wrapper class.  Write short note on character wrapper class.   Java Character Wrapper class The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
ModuleNotFoundError: No module named 'Wrapper'
ModuleNotFoundError: No module named 'Wrapper'  Hi, My Python... 'Wrapper' How to remove the ModuleNotFoundError: No module named 'Wrapper... to install padas library. You can install Wrapper python with following command
Version of tanukisoft>wrapper dependency
List of Version of tanukisoft>wrapper dependency
Maven Dependency wrapper >> 3.0.3
You should include the dependency code given in this page to add Maven Dependency of wrapper >> wrapper version3.0.3 in your project
java-wrapper class
java-wrapper class  dear people, may i know how to convert primitive data type into corresponding object using wrapper class with example please!!!   public class IntToIntegerExample { public static void
Version of com.itranswarp>es-wrapper dependency
List of Version of com.itranswarp>es-wrapper dependency
Version of com.moodysalem>phantomjs-wrapper dependency
List of Version of com.moodysalem>phantomjs-wrapper dependency
ModuleNotFoundError: No module named 'acs-wrapper'
ModuleNotFoundError: No module named 'acs-wrapper'  Hi, My Python... 'acs-wrapper' How to remove the ModuleNotFoundError: No module named 'acs-wrapper' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'aiohttp-wrapper'
ModuleNotFoundError: No module named 'aiohttp-wrapper'  Hi, My... named 'aiohttp-wrapper' How to remove the ModuleNotFoundError: No module named 'aiohttp-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'allocine-wrapper'
ModuleNotFoundError: No module named 'allocine-wrapper'  Hi, My... named 'allocine-wrapper' How to remove the ModuleNotFoundError: No module named 'allocine-wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'allocine-wrapper'
ModuleNotFoundError: No module named 'allocine-wrapper'  Hi, My... named 'allocine-wrapper' How to remove the ModuleNotFoundError: No module named 'allocine-wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'alphavantage-wrapper'
ModuleNotFoundError: No module named 'alphavantage-wrapper'  Hi...: No module named 'alphavantage-wrapper' How to remove the ModuleNotFoundError: No module named 'alphavantage-wrapper' error? Thanks   Hi
ModuleNotFoundError: No module named 'apt-wrapper'
ModuleNotFoundError: No module named 'apt-wrapper'  Hi, My Python... 'apt-wrapper' How to remove the ModuleNotFoundError: No module named 'apt-wrapper' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'apt-wrapper'
ModuleNotFoundError: No module named 'apt-wrapper'  Hi, My Python... 'apt-wrapper' How to remove the ModuleNotFoundError: No module named 'apt-wrapper' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'astromatic_wrapper'
ModuleNotFoundError: No module named 'astromatic_wrapper'  Hi, My... named 'astromatic_wrapper' How to remove the ModuleNotFoundError: No module named 'astromatic_wrapper' error? Thanks   Hi, In your

Ads