Sunday, December 16, 2012

[Java] How do you define a class?

You can define a class by using this syntax:
    class MyClass {
        //field, constructor, and
        //method declarations

    }
This is a class declaration. the class body (area between the braces) contains all 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 that provide the state of the class and its objects, and methods to implement the behavior of the class and its objects.

Remarks
Text provided above does not means is the model answer, and was posted here for an reference to someone who interested the titled topic only, if there is something incorrect, please leave a comment so that i can correct it, many thanks!

Reference:
https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html 
Introduction to Java Programming, Y. Daniel Liang

No comments :

Post a Comment