正在加载图片...
数据类型包装类的例 public class Exam i public static void main(String args[ D[ ∥构造方法 Integer a new Integer( Boolean b= new Boolean(true) Float f= new Float(-2. 4) Double d= new Double(1. 4) Character ch= new Character(A) Character ch2= new Character(A) ∥方法 int i= a. int Value(): char c= ch char Value(): System. out. printIn( System. out. printIn(b boolean Value( ) System. out. printIn(f float Value( ) System. out. printIn(d double Value( )) System. out. printIn(c) System. out. printIn(ch equals(ch2)) System. out. printIn(d to String( )数据类型包装类的例 public class Exam { public static void main(String args[ ]) { //构造方法 Integer a = new Integer(1); Boolean b = new Boolean(true); Float f = new Float(-2.4); Double d = new Double(1.4); Character ch = new Character('A'); Character ch2 = new Character('A'); //方法 int i = a.intValue( ); char c = ch.charValue( ); System.out.println(i); System.out.println(b.booleanValue( )); System.out.println(f.floatValue( )); System.out.println(d.doubleValue( )); System.out.println(c); System.out.println(ch.equals(ch2)); System.out.println(d.toString( )); } }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有