Alcuni esempi di conversioni di interi, stringhe, double in Java:
public static void main(String[] args) {
int unInt = 1;
String unaString = Integer.toString(unInt);
}
}
public class ConvertiStringInInt {
public static void main(String[] args) {
String unaString = "3478";
int unInt = Integer.parseInt(unaString);
System.out.println(unInt);
}
}
public static void main(String[] args) {
String unaString = "3478";
int unInt = Integer.parseInt(unaString);
System.out.println(unInt);
}
}
public class ConvertDoubleInString {
public static void main(String[] args) {
double unDouble= 0.12;
String unaString = Double.toString(unDouble);
}
}
public static void main(String[] args) {
double unDouble= 0.12;
String unaString = Double.toString(unDouble);
}
}
public class ConvertiStringInDouble {
public static void main(String[] args) {
String unaString = "4545";
double unDouble = Double.parseDouble(unaString);
System.out.println(unDouble);
}
}
public static void main(String[] args) {
String unaString = "4545";
double unDouble = Double.parseDouble(unaString);
System.out.println(unDouble);
}
}