Java Integer類常用方法
提問(wèn)人:劉旭39發(fā)布時(shí)間:2020-11-26
//Integer類常用方法
public class IntegerMethod{
public static void main(String[] args) {
String str = new Integer(10).toString();
Integer i1 = Integer.parseInt(str);
Integer i2 = Integer.valueOf("1");
int compareResult = Integer.compare(i1, i2);
System.out.println("String對(duì)象:"+str);
System.out.println("返回10的Integer對(duì)象:"+i1);
System.out.println("返回字符串為1的Integer對(duì)象:"+i2);
System.out.println("i1和i2的比較結(jié)果:"+compareResult);
}
}
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>