常用數據類型轉換

阅读更多

1、char---->String---->int----->Integer
      char<----String<----int<-----Integer
                           char c1='c'; String s=String.valueOf(c1);                                  String s="123"; int i=Integer.parseInt(s); i=123;              
char<<============================>>
String<<============================>>int
                  String s="abc"; char c1=s.charAt(2); c1='c';                                      int i=10; String s=String.valueOf(i);     
                     int i=123;Integer j=new Integer(i);                                                        Integer j=new Integer(10);String s=j.toString();  
int<<============================>>
Integer<<============================>>String
                  Integer j=new Integer(10); int i=j.intValue();                                          String s="123"; Integer i=Integer.valueOf(s);  

你可能感兴趣的:(J#,C,C++,C#)