package com.zx;
public class NotebookComputer01{
//定义一个非私有化的变量
private int num;
private CPU cpu;
//方法呗私有化
private 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);
}
}
定义一个测试类
package com.zx;
public class test02 {
public static void main(String[] args){
NotebookComputer01 com =new NotebookComputer01();com.Method(6);
}
}