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 |
How to create com object in Java?
Explain differences between collection api and stream api?
List out five keywords related to exception handling ?
What is a pattern what is an anti pattern?
Hi Friends, can you explain instance in java. In general instance means "occurence of something" . In java what is instance.
What do you understand by access specifiers in Java?
Can we inherit inner class?
What are recursive functions?
what value will be return by the read() method once it reaches the end-of-file? a. Throws EOException b. Return null c. Return -1 d. Read method return nothing, because it is void method
What are 5 boolean operators?
Can private class be inherited in java?
When abstract methods are used?