📄 d.java
字号:
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.
/* Class D extends A but is not in the same package.
* D can't use d2, get2(), or the class B which are
* visible only in package visibility. D can use d3
* and getd3(), but only from an object of type D, not
* from an object of type A. Class E can only use
* public data and methods.
*/
import visibility.*;
public class D extends A {
public static void main(String [] args) {
A a = new A();
D d = new D();
int i,j;
i = a.d1 + d.d3 + a.usePrivate();
j = a.get1() + d.get3();
System.out.println("i is " + i + " and j is " + j);
}
}
class E {
public static void main(String [] args) {
A a = new A();
D d = new D();
int i,j;
i = a.d1 + d.usePrivate();
j = d.get1();
System.out.println("i is " + i + " and j is " + j);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -