?? extendstest.java
字號:
//extendsTest.java
class c1{
int x=25;
private int y;
protected void print1(){
System.out.println("This is protected method. It can be extended.");
}
private void print2(){
System.out.println("This is private method.");
}
}
class extendsTest extends c1{
public static void main(String[] args){
c1 p = new c1();
System.out.println("p.x = "+p.x);
//System.out.println("p.y = "+p.y);//錯誤! y has private access in c1
p.print1();
//p.print2(); //錯誤! pirnt2() has private access in c1
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -