Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

object oriented programming

The document provides an overview of advanced object-oriented concepts in Java, including encapsulation, inheritance, and polymorphism. It discusses the structure of classes, the role of access modifiers, and the handling of exceptions. Additionally, it includes an example of implementing a time representation using instance variables and methods.

Uploaded by

zaynornah
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

object oriented programming

The document provides an overview of advanced object-oriented concepts in Java, including encapsulation, inheritance, and polymorphism. It discusses the structure of classes, the role of access modifiers, and the handling of exceptions. Additionally, it includes an example of implementing a time representation using instance variables and methods.

Uploaded by

zaynornah
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Advanced

object
oriented
java
Programming languages

Procedural Object
PL oriented PL
java Programming languages
java Review of object oriented
concepts
java Review of object oriented
concepts
• Private/public/protected members
• Accessor/Mutator Mehods
• Constructors
• Abstraction
• Exception
• Encapsulation
• Polymorphism
• Inheritence
• Composition
java Review of object oriented
concepts
Exception in Java
is an indication of a problem that occurs during a program’s execution. The name “exception” implies
that the problem occurs infrequently
java Review of object oriented
Encapsulation describes the idea of bundling data and methods that work on that data within
concepts
one unit, e.g., a class in Java. This concept is also often used to hide the internal
representation, or state, of an object from the outside. This is called information hiding.
java Review of object oriented
concepts (inheritance)
java Review of object oriented
concepts (composition)
java Review of object oriented
Variables
concepts
java Class Fields (Data)

Instance Static Local


variables variables variables

Methods
java EXAMPLE: Implement the time of the
day

Data (instance variables)


Operations (methods)
java Implement the time of the
day
To represent time in computer memory, We need the following
we use three int variables : one to methods over the data.
represent the hours, one to represent
the minutes, and one to represent the
1. Set the time.
seconds.
2. Retrieve the hour.
3. Retrieve the minutes.
Remember: Each class declaration that
4. Retrieve the seconds.
begins with keyword public must be
5. Print the time.
stored in a file that has the same name
6. Compare two times
as the class and ends with the .java file- equality.
name extension.
java REMARKS

• Recall that main is a special method that is always called


automatically by the Java Virtual Machine (JVM) when you execute
an application.

• A class that contains method main is a Java application.

You might also like