char a = 'h'; //类包装器 Character aobj = a ;//自动装箱 byte b = 6; Byte bobj = b; short s = 234; Short sobj = s; boolean b = true; Boolean bobj = b; int i = 100; Integer iobj = i; long l = 567L; Long lobj = l; float f = 8.99F; Float fobj = f; double d = 4.…
首先封装一个基本数据类型int, class P{ private int number; //封装一个私有的->基本数据类型 public P(){} public P(int number){this.number=number;} public int getNumber(){return this.number;} } 测试我们的封装 public class Ert { public static void main(String[] args) { int in=3; P p=new…