定义一个普通内部类
package com.zx;
public class NotebookComputer01{
//定义一个非私有化的变量
public int num;
public class CPU{
//类型
public String number;
//运行速度
public long speed;
public String counter(int num){
return Integer.toBinaryString(num);
}
}
}
定义一个测试类
package com.zx;
import com.zx.NotebookComputer01.CPU;
public class test02 {
public static void main(String[] args){
NotebookComputer01.CPU cpu = new NotebookComputer01().new CPU();
String name=cpu.counter(6);
System.out.print(name);
}
}