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 interface and its use?
Difference between an argument and a parameter?
10 Answers Accounting, HCL, IBM, Quinnox,
What happens if constructor is private?
abstract class A{ int list []=new int [100]; A(int x,int y){ rondom n=new rondom(); for (int i==;i<100;i++); list [i]=x+r.next int(y-x+1); abstract sort (); abstract binary sarch(int temp); class B extends A{
program to validate the IP address? Validity range should be 0 to 255
What is assembly language?
Difference between arraylist and hashset in java?
What is the difference between method overriding and overloading?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
How is string immutable in java?
what is net based application and its types
Why local variables are stored in stack?