dotest2.java
来自「JAVA编程思想第四版英文原版习题答案. pdf原版的」· Java 代码 · 共 25 行
JAVA
25 行
// object/DOTest2.java
// TIJ4 Chapter Object, Exercise 5, page 90
// Modify the previous exercise so that the values of the data in DataOnly are
// assigned to and printed in main().
public class DOTest2 {
public static void main(String[] args) {
class DataOnly {
int i;
double d;
boolean b;
void show() {
System.out.println(i);
System.out.println(d);
System.out.println(b);
}
}
DataOnly data = new DataOnly();
data.i = 234;
data.d = 2.1234545;
data.b = true;
data.show();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?