is this a way to convert String to integer?

is this a way to convert String to integer?

Integer currentStartingPrice = new Integer((String)startingPrice.getText());
int price = currentStartingPrice;

thx
Tom


tom_mkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Integer currentStartingPrice = new Integer(startingPrice.getText());
0
CEHJCommented:
Or just

int price = Integer.parseInt(startingPrice.getText());

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kiranhkCommented:
int       i = Integer.parseInt(s);
long       l = Long.parseLong(s);
float       f = Float.parseFloat(s);
double       d = Double.parseDouble(s);

Convert integers with some base (radix) other than 10 by using these two methods.
if you want to convert numbers in hexadecimal or base 2 ... use

int       i = Integer.parseInt(s, radix);
long       l = Long.parseLong(s, radix);

For example, to convert a string containing the hexadecimal number "F7" to an integer, call

i = Integer.parseInt("F7", 16)
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

kiranhkCommented:
0
tom_mkAuthor Commented:
i need to import this

import java.lang.*;
import java.lang.Object.*;

is tat correct?
0
CEHJCommented:
No. java.lang.* doesn't need importing
0
tom_mkAuthor Commented:
so only import java.lang.Object.*;  ??
0
kiranhkCommented:
by default/implicitly the java.lang package is available for the JVM
0
CEHJCommented:
>>so only import java.lang.Object.*;  ??

Dont import anything in lang
0
tom_mkAuthor Commented:
i did some silly mistake..

i solved the prob already

thxx
0
CEHJCommented:
Can you tell me why you accepted an answer that merely repeats the one i'd already given?
0
tom_mkAuthor Commented:
i accidentally press the wrong button though..

i just kinda hurry when i clicked. and i don't know how to cancle that :(
0
CEHJCommented:
>>and i don't know how to cancle that :(

By reopening the question ;-) i'll get it done
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.