Java 2.0 Theory
Java 2.0 Theory
crea ng new classes, each in their own file (e.g., Car, Person, Address, Bank, etc..). In fact,
All object-oriented languages (e.g., JAVA) allow you to organize your classes in a way that allows you
to take advantage of the commonality between classes. That is, we can define a class with certain
a ributes (and/or behaviors) and then specify which other classes share those same a ributes
(and/or behaviors). As a result, we can greatly reduce the amount of duplicate code that we would
be wri ng by not having to re-define the common a ributes and/or behaviors for all of the classes
that share such common features. JAVA accomplishes this task by arranging all of its classes in a
"family-tree”- like ordering called a class hierarchy. A class hierarchy is o en represented as an
upside down tree (i.e., the root of the tree at the top). The more “general” kinds of objects are
higher up the tree and the more “specific” (or specialized) kinds of objects are below them in the
hierarchy. So, a child object defined in the tree is a more specific kind of object than its parent or
ancestors in the tree
JAVA 9
Polymorphism is derived from two Greek words, “poly” and “morph”, which mean “many”
and “forms”, respectively. Hence, polymorphism meaning in Java refers to the ability of
objects to take on many forms. In other words, it allows different objects to respond to
the same message or method call in multiple ways.
Polymorphism allows coders to write code that can work with objects of multiple
classes in a generic way without knowing the specific class of each object.
Types of Polymorphism
There are two main types of polymorphism in Java: compile- me and run me.
Data abstrac on is the process of hiding certain details and showing only essen al informa on to the
user.
Abstrac on can be achieved with either abstract classes or interfaces (which you will learn more
about in the next chapter).
The abstract keyword is a non-access modifier, used for classes and methods:
Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be
inherited from another class).
Abstract method: can only be used in an abstract class, and it does not have a body. The body is
provided by the subclass (inherited from).
JAVA 10
Java Swing tutorial is a part of Java Foundation Classes (JFC) that is used to create window-
based applications. It is built on the top of AWT (Abstract Windowing Toolkit) API and
entirely written in java.
The javax.swing package provides classes for java swing API such as JButton, JTextField,
JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc.