回覆列表
  • 1 # 使用者7724478402265

    1.Integer轉換成int的方法Integer i; int k = i.intValue();即Integer.intValue();

    2.int轉換成Integerint i;Integer it = new Integer(i);

    3.String轉換成int的方法String str = "10"; Integer it = new Interger(str); int i = it.intValue(); 即:int i = Integer.intValue(string);

    4.int轉換成Stringint i;(1)String s = String.valueOf(i);(2)String s = Ingeger.toString(i);(3)String s = "" + i;

    5.String轉換成IntegerString str = "10"Integer it = Integer.valueOf(str);

    6.Integer轉換成StringInteger it;String str = it.toString();

    7.String轉換成BigDecimalBigDecimal bd = new BigDecimal(str);

    8.日期Calendar calendar = Calendar.getInstance();int year = calendar.get(Calendar.YEAR);int month = calendar.get(Calendar.MONTH)+1;int day = calendar.get(Calendar.DATE);//獲取今天的日期字串String today = Java.text.DateFormat.getDateInstance().format(new java.util.Date());//獲取今天的日期new java.sql.Date(System.currentTimeMillis());

  • 中秋節和大豐收的關聯?
  • 描寫春天夜裡月亮的古詩一整首?