Solved

How to convert String to Integer?

Posted on 2002-05-30
2
275 Views
Last Modified: 2010-03-31
Hello,

I want to convert a String to integer, how to do that

Thanks
0
Comment
Question by:yakelvin
2 Comments
 
LVL 2

Expert Comment

by:CSuvendra
ID: 7046253
Integer.parseInt(String) - returns int
Integer.valueOf(String) - returns Integer
0
 

Accepted Solution

by:
plrf earned 100 total points
ID: 7046261
if you want to convert String to Integer object   then


   String ns="250"; //any  string number
   Integer  n=new Integer(ns);

  and if you want  a int variable then

   String ns="250"; //any  string number
   Integer  n=new Integer(ns);
  int  nt=n.intValue();
 

 

 
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 51
topping3 challenge 14 50
Eclipse Neon and jdk 1.8.0 11 69
thymeleaf natural templating vs JSP 2 25
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now