This link has been bookmarked by 7 people . It was first bookmarked on 27 Mar 2007, by Mukesh Soni.
-
24 Aug 09
-
This is a class declaration. The class body (the area between the braces) c}
-
This is a class declaration. The class body (the area between the braces)
-
You can provide more information about the class, such as the name of its superclass, whether it implements any interfaces, and so on, at the start of the class declaration
-
extends MySuperClass implements YourInterface
-
The modifiers public and private, which determine what other classes can access
MyClass, are discussed later in this lesson
-
-
10 Feb 09
-
Declaring Classes
<!-- Declaring Classes --> You've seen classes defined in the following way:
This is a class declaration. The class body (the area between the braces) contains all the code that provides for the life cycle of the objects created from the class: constructors for initializing new objects, declarations for the fields that provide the state of the class and its objects, and methods to implement the behavior of the class and its objects.class MyClass { //field, constructor, and method declarations } -
You can also add modifiers like public or private at the very beginning—so you can see that the opening line of a class declaration can become quite complicated. The modifiers public and private, which determine what other classes can access
MyClass, are discussed later in this lesson. -
- Modifiers such as public, private, and a number of others that you will encounter later.
- The class name, with the initial letter capitalized by convention.
- The name of the class's parent (superclass), if any, preceded by the keyword extends. A class can only extend (subclass) one parent.
- A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface.
- The class body, surrounded by braces, {}.
In general, class declarations can include these components, in order:
-
-
03 Sep 08
-
class declaration.
-
class declaration.
-
class declaration.
-
class body (the area between the braces)
-
class declaration.
-
-
26 Jun 07
-
27 Mar 07
-
Modifiers such as public, private, and a number of others
-
A class can implement more than one interface.
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.