How to convert String into primitive datatype.

Answer Posted / akshya kumar

using the wrapper classes, by using the function in
following way:

int i_var = Integer.parseInt(string_var); //and as in
answer #2

Integer, Float, Long are wrapper classes predefined in JAVA
with methods parseInt(), parseFloat etc respectively.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to optimize the javac output?

777


What data structures are used to perform recursion?

788


What are the advantages of assembly language?

686


How can we make sure main() is the last thread to finish in java program?

913


Which class is the superclass for all the classes?

745


how are methods defined?

767


What happens when main () method is declared as private?

835


Explain what access modifiers can be used for methods?

777


When super keyword is used?

791


what is the difference between process and thread? : Java thread

763


Can a string be null?

720


What does java se mean?

762


Is object a data type?

744


Where and how can you use a private constructor?

726


What is the purpose of the system class in java?

749