- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert a string into a numeric primitive type using Integer.valueOf()
The Integer.valueOf() method is used in Java to convert a string into a numeric primitive type.
Let’s say the following is our string.
String str = "989";
To convert it into Integer primitive type, use Integer.valueOf()
Integer.valueOf(str)
Let us see the complete example to convert a string to Integer primitive type.
Example
public class Demo { public static void main(String[] args) { String str = "989"; System.out.println(Integer.valueOf(str)); } }
Output
989
Advertisements