2.1-1武汉大学国际软件学院信息系统导论.pptVIP

  • 4
  • 0
  • 约1.94万字
  • 约 81页
  • 2016-02-01 发布于湖北
  • 举报

2.1-1武汉大学国际软件学院信息系统导论.ppt

2.1-1武汉大学国际软件学院信息系统导论.ppt

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 不合法的Java标识符 Java Identifiers Java标识符 StudentName get_up _sys_path $pay $9test 7go %super I’am public get-name * Identifiers in Catfish Open Catfish.java 、、and look through it : Identifiers row column imageFileName getRow swimRightIfPossible * Java keywords Java语言中,有一部分标识符是系统定义的,有着专门的意义和用途,不能用于一般的标识符,这些标识符就叫做保留字或关键字。 abstract assert boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while 在Java中,true(真)、false(假)和null(空值)都是小写的,它们不是Java的关键字,但是在程序中不能把它们作为名字使用。 * Keywords in Catfish Keywords public, private class return String, int If…else Comments * Catfish.java给出了对类Catfish的定义 The description is provided by the source code enclosed within the opening brace and the closing brace. 类的定义中给出内容 attributes(属性值) behaviors(行为) Class Definition * Catfish -row: int -column: int -imageFileName: String +getRow(): int +getColumn(): int +getImage(): String +swimRightIfPossible() +swimLeftIfPossible() +swimDownIfPossible() +swimUpIfPossible() 属性(attribute) 消息(message) 行为(behavior) * [类修饰符] class 类名 [extends 父类名][implements 接口名{, 接口名}]{ 类体} public class Catfish { 类的主体 } 类修饰符 类名 public类标识符:如果一个类被声明为是public的,则与它不在同一个包(package)中的类也可以通过引用它所在的包来使用这个类。否则这个类就只能被同一个包使用。 Class Definition Format * [类修饰符] class 类名 [extends 父类名][implements 接口名{, 接口名}]{ 类体} public class Welcome extends HttpServlet { 类的主体 } 类修饰符 类名 父类名 Class Definition Format (cont) 继承 * 类中包含的内容(以Catfish类为例) Attributes private int row; private int column; private String imageFileName; private:是java的一个keyword(关键字)。标识这些属性只能由Catfis

文档评论(0)

1亿VIP精品文档

相关文档