Sei sulla pagina 1di 3

Dinda Fadia Dwitami/F34170033 TTS 2 - 12 September 2018

OBJECT ORIENTED PROGRAMMING

1. OOP has the concept that everything is object and object has a function to do its job in order to
solve the problem. The purpose of OOP was created to facilitate the development of the
program by following the models that already exist in everyday life. The different between
OOP and procedural programming is ; procedural programming is a collection of
instructions used to solve phenomena in a coherent and less flexible way. In procedural
programming separates data and action in one unit, while in OOP security is achieved because
the class wraps the action in one unit.

2. Simple program containing all java elements


3. Java program defining objects
4. Modifiers are keywords that are added to change meaning of a definition. Types of modifier in
java are :
• Modifiers for classes, interfaces, and enums
✓ Abstract : The class cannot be instantiated.
✓ Final : The class cannot be extended.
✓ Public : Its members can be accessed from any other class.
✓ Strictfp : Floating point results will be platform independent.
• Constructor Modifiers:
✓ Private : It is accessible only from within its own class.
✓ Protected : It is accessible only from within its own class and its extension.
✓ Public : It is accessible from all classes.
• Field Modifiers :
✓ Final : It must be initialized and cannot be changed.
✓ Private : It is accessible only from within its own class.
✓ Protected : It is accessible only from within its own class and its
extensions.
✓ Public : It is accessible from all classes.
✓ Static : The same storage is used for all instances of the class.
✓ Transient : It is not part of the persistent state of an object.
✓ Volatile : It may be modified by asynchronous threads.
• Method Modifiers:
✓ Abstract : Its body is absent.
✓ Final : It cannot be overridden in class extensions.
✓ Native : Its body is implementes in another programming language.
✓ Private : It is accessible only from within its own class.
✓ Protected : It is accessible only from within its own class and its
extensions.
✓ Public : It is accessible from all classes.
✓ Static : It has no implicit argument.
✓ Stricrfp : Its floating point results will be platform independent.
✓ Volatile : It may be modified by asynchronous threads.
• Local Variable Modifier:
✓ Final : It must be initialized and cannot be changed.

Potrebbero piacerti anche