1.basic Concepts in Java
1.basic Concepts in Java
JAVA
Object-Oriented Design
◦ Object-oriented design is a technique that focuses design
on objects and classes based on real world scenarios. It
emphasizes state, behavior and interaction of objects. It
provides the benefits of faster development, increased
quality, easier maintenance, enhanced modifiability and
increase software reuse
Class
◦A class allows you to define new data
types. It serves as a blueprint, which is a
model for the objects you create based on
this new data type.
Object
◦ An object is an entity that has a state, behavior and
identity with a well-defined role in problem space. It
is an actual instance of a class. Thus, it is also
known as an instance. It is created every time you
instantiate a class using the new keyword.
Attribute
◦An attribute refers to the data element of
an object. It stores information about the
object. It is also known as a data member,
an instance variable, a property or a data
field.
Method
◦A method describes the
behavior of an object. It is also
called a function or a
procedure.
Constructor
◦A constructor is a special type of
method used for creating and
initializing a new object. Remember
that constructors are not members
Package
◦A package refers to a grouping of
classes and/or subpackages. Its
structure is analogous to that of a
directory.
Encapsulation
◦Encapsulation refers to the principle of
hiding design or implementation
information that are not relevant to
the current object
Abstraction
◦While encapsulation is hiding the details
away, abstraction refers to ignoring aspects
of a subject that are not relevant to the
current purpose in order to concentrate
more fully on those that are.
Inheritance
◦ Inheritance is a relationship between classes wherein
one class is the superclass or the parent class of
another. It refers to the properties and behaviors
received from an ancestor. It is also know as a "is-a"
relationship. Consider the following hierarchy
Polymorphism
◦Polymorphism is the ability of an
object to assume may different forms.
Literally, "poly" means many while
"morph" means form.
Interface
◦An interface is a contract in the form of a
collection of method and constant
declarations. When a class implements an
interface, it promises to implement all of
the methods declared in that interface.