AllFreePapers.com - All Free Papers and Essays for All Students
Search

What Is a Java Class

Autor:   •  July 4, 2014  •  Essay  •  354 Words (2 Pages)  •  1,022 Views

Page 1 of 2

A class is used to create and define specific instances and objects. Every object is associated with a class. If saving account is a class, all objects that capture information about savings account could fall into a class called Savings Account, because there are attributes (account type, FDIC insurance, interest, statement, account number, etc.) and methods (calculate interest rate, statement transmission, deposit, withdrawal, etc.) that all savings account share.

A superclass is an upper-level class that has a general relationship that provides all its attributes and behaviors’ to the subclasses. In this case, the saving account would be the superclass. The attributes of the savings account include; account type, FDIC insurance, interest, etc.

The subclass can define additional instance fields and methods, like Passbook Savings or Certificate of Deposit. These features are at the second level below the account class and therefore considered subclass. These lower-levels inherit all of the attributes and behaviors of the superclass. Each subclass can add attributes and behaviors of its own, but it cannot remove those of the superclass.

The data contained in an object is the object's attribute. Examples of the attributes for the savings account class include; account number, interest rate, electronic statement, email address, etc.

The procedures or behaviors that an object performs are the methods. Methods are also used to access an object's private data. Examples of methods that are present in the savings account class include; calculate interest, send statement, deposit, withdraw, etc.

Each object that is created from a class is called an instance of the class. The instance (object) provides more specifics on the object's class, but also inherits the objects from the class. In the savings account class this can include the type of statement, electronic

...

Download as:   txt (2.2 Kb)   pdf (52.2 Kb)   docx (10.4 Kb)  
Continue for 1 more page »