Class Java

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

CLASS

DEFINITION
A class in the context of Java are templates that
are used to create objects, and to define object data
types and methods. Core properties include the
data types and methods that may be used by the
object. All class objects should have the basic class
properties. Classes are categories, and objects are
items within each category.
Example
This may be explained with a hypothetical
example of a tree and types of trees. Generally, a
tree should have branches, stems and leaves.
Thus if Banyan is a tree, Banyan should have all of
the characteristics of a tree, such as branches,
stems and leaves. It is impossible to say that a
pigeon is a tree, because the pigeon does not have
branches, stems and leaves. Similarly, basic Java
object properties are defined within that object’s
corresponding class.
A class declaration is made up of the
following parts 

Modifiers
Class name
Keywords
Class body within curly brackets {}
CLASS VARIABLES
Class variables also known as static variables are
declared with the static keyword in a class, but
outside a method, constructor or a block. There
would only be one copy of each class variable per
class, regardless of how many objects are created
from it.
CLASS MEMBERS
Every single thing which are in the scope of the
class is called class members, not only in java but
this can also be applied in other programming
languages.
For example, if objects and methods are in the
scope of class 'A', they are the class members of
class 'A'.
There are five members in class

Member Variables (States)


Methods (Behaviors)
Constructor
Blocks (Instance/Static Blocks )
Inner Classes.
CLASS LIBRARY
The uses of the java libraries of class spread the
programmer efficiency by allowing computer
programmer to focus on the functionality unique to
their job. The library classes are generally planned with
some typical usage pattern in observance, and the
performance may be suboptimal if the actual usage
differs. We deliver an approach for rewriting
applications to use different customized versions of
library classes that are generated using a combination
of static analysis and profile information.
ADVANTAGES OF CLASS LIBRARY
The type constraints are used to control where the java library classes can be replaced
with routine versions without affecting type perfection of programs.

Static analysis is then used to control those applicants for which unused library
functionality and synchronization can be removed safely from the allocated types.

The profile data is collected about the usage features of the customization candidates to
determine where the allocation of custom library classes is likely to be cost-effective.

To base on the static analysis results and the profiling information the custom library
classes are automatically generated from a template.

The bytecode of the client application is rewritten to use the generated custom classes.
This bytecode rewriting is completely see-through to the programmer.
CLASS DIAGRAM
Class diagram is a static diagram. It represents
the static view of an application. Class diagram is
not only used for visualizing, describing, and
documenting different aspects of a system but also
for constructing executable code of the software
application.
Class diagram describes the attributes and
operations of a class and also the constraints
imposed on the system. The class diagrams are
widely used in the modeling of object oriented
systems because they are the only UML diagrams,
which can be mapped directly with object-oriented
languages.

Class diagram shows a collection of classes,


interfaces, associations, collaborations, and
constraints. It is also known as a structural diagram.
Purposes of Class Diagram

Analysis and design of the static view of an


application.
Describe responsibilities of a system.
Base for component and deployment diagrams.
Forward and reverse engineering.
THANK
YOU

You might also like