How to convert String into primitive datatype.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / akshya kumar
we can also use valueOf method of wrapper classes like:
int i_var = Integer.valueOf(string_var);
float f_var = Float.valueOf(string_vatr);
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / niranjan sahoo
by using parsing methods of the respective primitive type like if we want to convert into int then use parseint() , if float then use parsefloat()...
| Is This Answer Correct ? | 3 Yes | 3 No |
What is the function of log?
How to synchonise HashMap
What are the string methods in java?
What is garbage collection in Java, and how can it be used ?
32 Answers Accenture, HCL, Infosys, Sara, SITS, TCS, Wipro,
What are the access modifiers available in java?
Why is it important to initialize a variable?
why we use merge option in hybernate pls give a ex snippet
What is <> used for in java?
What is the exact difference in between Unicast and Multicast object?
how can you take care of mutual exclusion using java threads? : Java thread
When you declare a method as abstract method ?
methods in Applet?