\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 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









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  wrapper class methods
wrapper class
wrapper class  list 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       7.Wrapper This new wrapper interface provides a mechanism for accessing an instance of a resource. This is used by many JDBC driver implementations. Earlier the wrapper used to be data
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
Wrapper Class - Java Beginners
Wrapper Class  What is Wrapper class? Why are they use
Maven Repository/Dependency: wrapper | wrapper
Maven Repository/Dependency of Group ID wrapper and Artifact ID wrapper. Latest version of wrapper:wrapper dependencies. # Version Release Date 1 3.0.3 01 Aug 2005
Wrapper Class - Java Beginners
Wrapper Class  Please explain the above question on Wrapper class with some examples
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
Wrapper Classes
Primitive Wrapper Class In this section you will learn about Wrapper classes.... Wrapper class is a wrapper around a primitive data type. It represents... can be represented as a Boolean class instance. All of the primitive wrapper
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.moodysalem>phantomjs-wrapper dependency
List of Version of com.moodysalem>phantomjs-wrapper dependency
Version of com.itranswarp>es-wrapper dependency
List of Version of com.itranswarp>es-wrapper dependency
wrapper prob - Java Beginners
wrapper prob  Hello all Integer k = 128; Integer l = 128; System.out.println("k==l >> "+ (k==l)); Integer i = 127; Integer j = 127; System.out.println("i==j >> "+ (i==j)); Can anybody tell me that why
ModuleNotFoundError: No module named 'attribute_wrapper'
ModuleNotFoundError: No module named 'attribute_wrapper'  Hi, My... named 'attribute_wrapper' How to remove the ModuleNotFoundError: No module named 'attribute_wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'axel-wrapper'
ModuleNotFoundError: No module named 'axel-wrapper'  Hi, My Python... 'axel-wrapper' How to remove the ModuleNotFoundError: No module named 'axel-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'djsw_wrapper'
ModuleNotFoundError: No module named 'djsw_wrapper'  Hi, My Python... 'djsw_wrapper' How to remove the ModuleNotFoundError: No module named 'djsw_wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'es_wrapper'
ModuleNotFoundError: No module named 'es_wrapper'  Hi, My Python... 'es_wrapper' How to remove the ModuleNotFoundError: No module named 'es_wrapper' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'fsq-wrapper'
ModuleNotFoundError: No module named 'fsq-wrapper'  Hi, My Python... 'fsq-wrapper' How to remove the ModuleNotFoundError: No module named 'fsq-wrapper' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'gmx_wrapper'
ModuleNotFoundError: No module named 'gmx_wrapper'  Hi, My Python... 'gmx_wrapper' How to remove the ModuleNotFoundError: No module named 'gmx_wrapper' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'grpc_wrapper'
ModuleNotFoundError: No module named 'grpc_wrapper'  Hi, My Python... 'grpc_wrapper' How to remove the ModuleNotFoundError: No module named 'grpc_wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jinja-wrapper'
ModuleNotFoundError: No module named 'jinja-wrapper'  Hi, My... 'jinja-wrapper' How to remove the ModuleNotFoundError: No module named 'jinja-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'koji-wrapper'
ModuleNotFoundError: No module named 'koji-wrapper'  Hi, My Python... 'koji-wrapper' How to remove the ModuleNotFoundError: No module named 'koji-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'label-wrapper'
ModuleNotFoundError: No module named 'label-wrapper'  Hi, My... 'label-wrapper' How to remove the ModuleNotFoundError: No module named 'label-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ltlcross-wrapper'
ModuleNotFoundError: No module named 'ltlcross-wrapper'  Hi, My... named 'ltlcross-wrapper' How to remove the ModuleNotFoundError: No module named 'ltlcross-wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'marionette-wrapper'
ModuleNotFoundError: No module named 'marionette-wrapper'  Hi, My... named 'marionette-wrapper' How to remove the ModuleNotFoundError: No module named 'marionette-wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mcserver-wrapper'
ModuleNotFoundError: No module named 'mcserver-wrapper'  Hi, My... named 'mcserver-wrapper' How to remove the ModuleNotFoundError: No module named 'mcserver-wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'memcache_wrapper'
ModuleNotFoundError: No module named 'memcache_wrapper'  Hi, My... named 'memcache_wrapper' How to remove the ModuleNotFoundError: No module named 'memcache_wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'module-wrapper'
ModuleNotFoundError: No module named 'module-wrapper'  Hi, My... named 'module-wrapper' How to remove the ModuleNotFoundError: No module named 'module-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mongo-wrapper'
ModuleNotFoundError: No module named 'mongo-wrapper'  Hi, My... 'mongo-wrapper' How to remove the ModuleNotFoundError: No module named 'mongo-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mysqldb-wrapper'
ModuleNotFoundError: No module named 'mysqldb-wrapper'  Hi, My... named 'mysqldb-wrapper' How to remove the ModuleNotFoundError: No module named 'mysqldb-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'nameko-wrapper'
ModuleNotFoundError: No module named 'nameko-wrapper'  Hi, My... named 'nameko-wrapper' How to remove the ModuleNotFoundError: No module named 'nameko-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'netperf-wrapper'
ModuleNotFoundError: No module named 'netperf-wrapper'  Hi, My... named 'netperf-wrapper' How to remove the ModuleNotFoundError: No module named 'netperf-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'openssh-wrapper'
ModuleNotFoundError: No module named 'openssh-wrapper'  Hi, My... named 'openssh-wrapper' How to remove the ModuleNotFoundError: No module named 'openssh-wrapper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'patchelf-wrapper'
ModuleNotFoundError: No module named 'patchelf-wrapper'  Hi, My... named 'patchelf-wrapper' How to remove the ModuleNotFoundError: No module named 'patchelf-wrapper' error? Thanks   Hi, In your

Ads