

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Converting Strings to Numbers and Vice Versa in Java.
Java lang package provides Integer class which has methods to convert an integer to String and vice versa. You can convert a String to an integer using the parseInt() method and Integer to String using the toString() method.
Example
public class Sample { public static void main(String args[]){ String str = "1212"; int num = Integer.parseInt(str); System.out.println(num); String st = Integer.toString(num); System.out.println(); } }
Output
1212
- Related Questions & Answers
- Converting string to number and vice-versa in C++
- How to convert String to StringBuilder and vice versa Java?
- Binary to decimal and vice-versa in Python
- How to convert an array to Set and vice versa in Java?
- Convert string to DateTime and vice-versa in Python
- Adding Tuple to List and vice versa in Python
- C Program for LowerCase to UpperCase and vice-versa
- How to Convert a String to Hexadecimal and vice versa format in java?
- Converting Strings to Numbers in C/C++
- Java Program to Convert the LinkedList into an Array and vice versa
- Java Program to Convert the ArrayList into a string and vice versa
- Converting strings to numbers with vanilla JavaScript
- Convert from any base to decimal and vice versa in C++
- Java Program to Convert contents of a file to byte array and Vice-Versa
- C++ Program to Convert Binary Number to Decimal and vice-versa
Advertisements