Think in java 答案_Chapter 2_Exercise 4

来源:互联网 发布:表情包 面具 淘宝 编辑:程序博客网 时间:2024/04/28 20:28

阅前声明: http://blog.csdn.net/heimaoxiaozi/archive/2007/01/19/1487884.aspx

/****************** Exercise 4 ******************
* Modify Exercise 3 so that the values of the
* data in DataOnly are assigned to and printed
* in main().
***********************************************/

public class E04_DataOnly2 {
  int i;
  float f;
  boolean b;
  public static void main(String[] args) {
    E04_DataOnly2 d = new E04_DataOnly2();
    d.i = 47;
    System.out.println("d.i = " + d.i);
    d.f = 1.1f;
    System.out.println("d.f = " + d.f);
    d.b = false;
    System.out.println("d.b = " + d.b);
  }

//+M java E04_DataOnly2

原创粉丝点击