0
Variables
how to get the variable that is both String and Double.
4 Respostas
0
A variable cannot have two different data types. It can be a string or a double. But you can do this.
String str = "12.5";
double num = Double.parseDouble(str);
First you can create string with double type value but it will be string only and then you can convert it to double.
0
and then it can calculate as double ,right?
0
Yes after converting it to double you can perform any arithmetic operations on it.
0
if I want to check a=me and run like this
String a="me";
if a="me" {
System.out.print("ok");
}
it cant run if because a is string. so how can i do like this? thanks for helping :)