In this section, we are going to learn to convert a numeric string type Object into a primitive type int and Integer Object to primitive type int. .
Code Description:
The following program converts numeric string type object into primitive type int and Integer type object to primitive type int. The parseInt() method of an Integer class takes a numeric string object and returns the primitive type int value. Again, this program converts an Integer object into a primitive type int using the intValue() method.
Here is the code of this program:
import java.io.*;
|
Output of this program
| C:\vinod>javac ObjectToInt.java C:\vinod>java ObjectToInt Numeric string to primitive int = 123 Integer object ot primitive int = 123 C:\vinod> |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert Object to Int View All Comments
Post your Comment