Skip to main content
Java Object Oriented



                M Iqbal Al Ghazaly

This beginner Java tutorial describes fundamentals of
 programming in the Java programming language.
OOP
Object Oriented Programming (OOP) is a programming method that
  based from object. Small think from OOP is an object collection that
  interact with each other and excange an information




Inheritance
Polymorphism
Abstraction
Encapsulation
Inheritance


A class that is derived from another class is
called a subclass . The class from which the
 subclass is derived is called a superclass .
Inheritance illustration
Polymorphism


 The word "polymorphism" means "many
 forms". It comes from Greek word "poly"
(means many) and "morphos" (means form).
Polymorphism illustration
Abstraction

Abstraction is a very important element of object oriented
software development and is used in the design phase to
find a suitable hierarchy for a set of classes.
Abstraction refers to the ability to make a class abstract in
OOP. An abstract class is one that cannot be instantiated.
All other functionality of the class still exists, and its
fields, methods, and constructors are all accessed in the
same manner. You just cannot create an instance of the
abstract class.
Encapsulation
Encapsulation is one of the four fundamental OOP concepts.
  The other three are inheritance, polymorphism, and
  abstraction.
Synonym: information hiding
Encapsulation is one of the most important characteristics of
  an object oriented system.
Repetition Control Structures
Decision control structures are Java statements that
 allows us to select and execute specific blocks of
        code while skipping other sections.


                   If statement
                 Switch statement
           Repetition Control Structures
If statement
The if-statement specifies that a statement (or block of
 code) will be executed if and only if a certain
 boolean statement is true.
Devided by 3,they are:


If-else
If-else-if
If-else-else-if
Switch statement


Another way to indicate a branch is through the
  switch keyword. The switch construct allows
        branching on multiple outcomes.
switch( switch_expression ){
case case_selector1:
statement1;
statement2;


break;
case case_selector2:
statement1;
statement2;
break; default: statement1;statement2;
break;


}
Repetition Control Structures
Repetition control structures are Java statements that
 allows us to execute specific blocks of code a
 number of times. There are three types of repetition
 control structures, the while, do-while and for loops.
While loop

    The while loop is a statement or block of statements
        that is repeated as long as some condition is
                           satisfied.

while( boolean_expression ){
statement1;
statement2;
...
}
do- while
The do-while loop is similar to the while-loop. The
 statements inside a do-while loop are executed
 several times as long as the condition is satisfied.

do{
statement1;
statement2;
...
}while( boolean_expression );
For-loop
The for loop, like the previous loops, allows execution
 of the same code a number of times.



for (InitializationExpression; LoopCondition; StepExpression){
statement1;
statement2;
...
}
Arithmetic in java

Arithmetic has a job such as mathematics, it uses for
    doing mathematic's operation, such as pluses,
            division, minuses, and times