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

Can we make constructors static?

715


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

632


Can memory leak in java?

576


How does class forname work in java?

475


Are arrays dynamic in java?

528






In a class implementing an interface, can we change the value of any variable defined in the interface?

548


What is procedure overloading?

1796


What is static and final keyword in java?

571


What is the purpose of lambda expressions?

578


How a string is stored in memory?

572


What is * argv?

696


How do you escape json?

536


Does printwriter create a file?

534


Discuss different types of errors that generally occur while programming.

571


How can I right-justify a string?

619