Solved

How to convert String to Integer?

Posted on 2002-05-30
2
277 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 62
even odd program using while loop 3 29
java stored proc example 9 22
servlet filter example 37 43
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

920 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

13 Experts available now in Live!

Get 1:1 Help Now