0% found this document useful (0 votes)
16 views

Object Oriented Programming

OOP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Object Oriented Programming

OOP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

- Java is modeled after C++.

ORIENTED
INTEGRATED DEVELOPMENT ENVIRONMENT

PROGRAMMING (IDE)

- Software for building applications


COVERAGE

- introduction to encapsulation
PROGRAMMING FUNDAMENTALS
TYPES OF TEST PART 1
- multiple choice 20pts
PROGRAMMING ERRORS
- code analysis 7 items 14pts (Java
fundamentals) 3 TYPES OF ERROR
- class diagram analysis (class diagram is
1. Syntax error
given, just answer 6 questions)
- Error detected by compiler
- class UML diagram design (Translate
description to diagram 10pts) 2. Runtime Error
- Program terminates
abnormally.
3. Logic Error
INTRODUCTION TO JAVA - Program does not perform the
way it was intended to
BACKGROUND
IDENTIFIERS
- Developed by James Gosling’s team
at Sun Microsystems. - Names that identifies classes,
- Sun Microsystems was purchased by methods,and variables
Oracle in 2010. - An identifier must start with a letter,
- Originally called oak. an underscore (_), or a dollar sign
- Originally used in embedded chips in ($). It cannot start with a digit.
electronic appliances. - An identifier cannot be a reserved
- “Write once run anywhere” word.
- An identifier cannot be true, false, or
TECHNOLOGY
null.
- Java initially became attractive - An identifier can be of any length.
because Java programs can run
PRIMITIVE DATA TYPES
from a web browser. Such programs
are called applets. - integers, real numbers, characters,
and Boolean types.
FEATURES
- known as primitive data types or
- Java runs on a hypothetical fundamental types.
computer known as the Java Virtual
VARIABLES
Machine (JVM).
- “Write once, run anywhere” (WORA) - Variables are used to represent
is the slogan developed by Sun values that may be changed in the
Microsystems program.
- Variables are for representing data of - is a construct that enables a
a certain type. program to specify alternative paths
of execution.
PROGRAMMING FUNDAMENTALS
IF-ELSE STATEMENT
PART 2 - Two-way statement

NESTED IF STATEMENT
Named Constant - The statement in an if or if-else
- syntax: final datatype CONSTANT statement can be any legal Java
NAME = value; statement, including another if or
if-else statement.

TERNARY OPERATOR
AUGMENTED ASSIGNMENT OPERATORS
- Short-hand if else
- Ex. count = count + 1;
- count += 1; SWITCH STATEMENT

INCREMENT AND DECREMENT OPERATORS - it executes statements based on the


value of a variable or an expression.
Postfix Increment / Postfix Decrement
LOOPS
- int i = 3, j = 3;
- i++; // i becomes 4 - A loop can be used to tell a program
- j--; // j becomes 2 to execute statements repeatedly

Prefix Increment /Prefix Decrement WHILE LOOP

- int i = 3, j = 3; - p executes statements repeatedly


- ++i; // i becomes 4 while the condition is true.
- --j; // j becomes 2 DO-WHILE LOOP
-
- is the same as a while loop except
LOGICAL OPERATOR that it executes the loop body first
- The logical operators !, &&, ||, and ^ then checks the loop continuation
can be used to create a compound condition
Boolean expression. FOR LOOP
- EXCLUSIVE OR ^
- T+T =F - A for loop generally uses a variable to

- F+F=F control how many times the loop

- T+F=T body is executed and when the loop

- F+T=T terminates.

04- CONTROL STRUCTURES AND 07- OBJECT-ORIENTED


DECISIONS PROGRAMMING (OOP)

IF STATEMENT PROCEDURAL PROGRAMMING


- A programming model which is - public - the code is accessible
derived from structured for all classes
programming, based upon the - private - the code is only
concept of calling procedure. accessible within the declared
class
OOP
- default - the code is only
- A programming pattern that is built accessible within the same
around objects or entities. package
- protected - the code is
CLASS
accessible in the same
- is a template or “blueprint” for package and subclasses
objects. - NON-ACCESS MODIFIERS: do not

OBJECT control the access level


- final- the class cannot be
- is an instance of a class inherited by other classes
- abstract- the class class
08- OBJECT-ORIENTED
cannot be used to create
PROGRAMMING (OOP): objects. To access an abstract
ENCAPSULATION class, it must be inherited from
another class

. For attributes and methods, you can use:


CONSTRUCTOR
- final - attributes and methods
- special method used to initialize
cannot be
objects.
overridden/modified
- The public keyword that we are using
- static - Attributes and
in our class declarations is an
methods belongs to the class,
example of an access modifier.
rather than an object
2 TYPES OF MODIFIERS - abstract - can only be used in
an abstract class, and can
- ACCESS MODIFIERS: Controls the
only be used on methods. The
access level
method does not have a body
- public - the class is accessible
for example abstract void
by any other class
run(); The body is provided by
- default - the class is only
the subclass (inherited form).
accessible by classes in the
same package. This is used ENCAPSULATION
when you don’t specify a
- One of the fundamentals of
modifier.
object-oriented programming
For attributes, methods, and constructors, - Getters or the get method returns
you can use: the variable value ●
- Setters or the set method sets the
value
pet has pet details

pet diamond here line pet details

PRACTICE CODE POINTERS

- Pre and postfix increment and


decrement
- If else, do while, while, switch
- Logical operators
- Modulo
- UML
- Switch case
- oop, encap

You might also like