1.int (including length), float,double
Int->float->double cast, no data loss.
Double->float->int cast, loss of data.
such as int a = (int) 5.3;
System,out.println (a);
The screen now displays 5.
2. How do I convert string strings to integer int?
int i = integer.valueof (my_str). Intvalue ();
int I=integer.parseint (str);
3. How do I convert string strings to integers?
Integer integer=integer.valueof (str);
4. How do I convert integer int into string string?
1.) String s = string.valueof (i);
2.) String s = integer.tostring (i);
3.) String s = "" + I;
5. How do I convert an integer int to an integer?
Integer integer=new integer (i);
6. How do I convert integers to string strings?
Integer integer=string
7. How do I convert an integer to int?
int Num=integer.intvalue ();
8. How do I convert a string to BigDecimal?
BigDecimal d_id = new BigDecimal (str);
9. How do I convert a String to char?
Char[] ca= "123". ToCharArray ();
10. How do I convert char to string?
String s=ca.tostring (); Any type can be converted to a string type with ToString ()
-----------------Date-------------------------
Calendar calendar=calendar.getinstance ();
int Year=calendar.get (calendar.year);
int Month=calendar.get (calendar.month) +1;
int Day=calendar.get (calendar.date);
Get today's date string
String today=java.text.dateformat.getdateinstance (). Format (new java.util.Date ());
Get today's date
New Java.sql.Date (System.currenttimemillis ())
Various types of transformation in Java