TP3类与对象的基本概念.pptVIP

  • 2
  • 0
  • 约7.38千字
  • 约 39页
  • 2016-12-28 发布于北京
  • 举报
* this 关键字的示例 class Pixel { int x; int y; void init (int x, int y) { this.x = x; this.y = y; } public static void main (String args[]) { Pixel p = new Pixel(); p.init (4,3); } } 此程序初始化 x = 4 和 y = 3 对象的引用 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * 构造方法 每当创建给定类的实例时就调用的方法 与类同名,但没有返回类型 Java 为对象分配内存,初始化实例变量并调用构造方法 两种构造方法 参数化构造方法 隐式构造方法 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. *

文档评论(0)

1亿VIP精品文档

相关文档