+ 1
How to convert datatypes in Java
Is it possible used to convert datatypes between each other in Java? Like in python? For example String to int, string to array, int to string... If so, How?
3 ответов
+ 3
String to int:
String s = "42";
int num = Integer.parseInt(s);
Int to String:
int num = 42;
String s = String.valueOf(num);
+ 2
r8w9 do the parseInt and valueOf methods require any libraries?
+ 1
No.