java65-类访问static修饰的内部类

public class NotebookComputer01{
//定义一个非私有化的变量
private static int num;
private CPU cpu;
//方法呗私有化
public static class CPU{
//类型
private String number;
//运行速度
private long speed;
public void counter(int num){
System.out.println(Integer.toBinaryString(num));
}
}
public void Method(int num){
this.num=num;
CPU cpu=new CPU();
cpu.counter(num);
}
}
定义一个测试类
ublic class test02 {
public static void main(String[] args){
   NotebookComputer01.CPU com =new NotebookComputer01.CPU();
   com.counter(6);

}
}
 

posted @ 2022-06-22 22:55  前端导师歌谣  阅读(27)  评论(0)    收藏  举报