0% found this document useful (0 votes)
50 views71 pages

OOPR211 Module-2

The document outlines the roadmap and modules for an Object-Oriented Programming course. It includes 6 topics: course orientation, introduction to OOP concepts, history and structure of Java, data types and operations, input/output commands, and a preliminary exam. The second module discusses the history of Java starting in 1991 and its features like being portable, object-oriented, secure, and robust. It also explains the basic structure of a Java program including class definition, method definition, and programming errors.
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)
50 views71 pages

OOPR211 Module-2

The document outlines the roadmap and modules for an Object-Oriented Programming course. It includes 6 topics: course orientation, introduction to OOP concepts, history and structure of Java, data types and operations, input/output commands, and a preliminary exam. The second module discusses the history of Java starting in 1991 and its features like being portable, object-oriented, secure, and robust. It also explains the basic structure of a Java program including class definition, method definition, and programming errors.
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/ 71

OUR LADY OF FATIMA UNIVERSITY

COLLEGE OF COMPUTER STUDIES


OOPR211
OBJECT-ORIENTED
PROGRAMMING I
PRELIMS ROADMAP
COURSE HISTORY AND INPUT AND OUTPUT
ORIENTATION STRUCTURE OF JAVA COMMANDS
1 3 5

2 4 6

INTRODUCTION TO DATA TYPES, PRELIMINARY


OBJECT-ORIENTED VARIABLES, CONSTANTS EXAMINATION
CONCEPTS AND OPERATORS
PRELIMS ROADMAP
COURSE HISTORY AND INPUT AND OUTPUT
ORIENTATION STRUCTURE OF JAVA COMMANDS
1 3 5

2 4 6

INTRODUCTION TO DATA TYPES, PRELIMINARY


OBJECT-ORIENTED VARIABLES, CONSTANTS EXAMINATION
CONCEPTS AND OPERATORS
2
Module :
HISTORY AND
STRUCTURE OF JAVA
Module Objectives:

1 2

Familiarize the Learn to compile a


structure of Java basic program using
Language Java Syntax
Topics:

⊳ History of Java
⊳ Features of Java

⊳ Structure of a Java Program

⊳ Programming Errors in Java


1 History of Java
It begins in 1991…

the company that introduce Java


It begins in 1991…
THE Green Team
GREEN PROJECT
A research project that leads to the development of Java.
It was intended for consumer electronic devices such as
televisions and computers.
JAMES GOSLING
CHIEF ENGINEER of the Green Project
JAMES
created the
GOSLING
OAK PROGRAMMING LANGUAGE
to meet the objective of green project.
In 1992…
OAK
FIRST NAME OF JAVA
WAS NAMED AFTER
AN OAK TREE OUTSIDE
HIS OFFICE.
In 1992…
In 1992…
JAVA
DERIVED FROM LOCAL
COFFEE SHOP.
THAT’S WHY ITS ICON IS LIKE A
“CUP OF COFFEE”.
In 1995…

Is officially Born.
In 1995…
The PROMISE…

WORA
“Write Once, Run Anywhere“
Today…
In 2010…
WHAT IS

JAVA
JAVA
A GENERAL-PURPOSE,
CONCURRENT, OBJECT-
ORIENTED, CLASS-BASED,
AND THE RUNTIME
ENVIRONMENT(JRE)
WHICH CONSISTS OF JVM
WHICH IS THE
CORNERSTONE OF THE
JAVA PLATFORM
JAVA
AN OBJECT-ORIENTED LANGUAGE FOR
GENERAL-PURPOSE BUSINESS
APPLICATIONS AND FOR INTERACTIVE,
WEB-BASED INTERNET APPLICATIONS.
JAVA IS FREE TO ACCESS AND
CAN RUN ON ALL PLATFORMS.
?????
WHAT IS
JAVA
USED FOR
What is Java Used for?
BANKING:
TO DEAL WITH TRANSACTION MANAGEMENT.
RETAIL:
BILLING APPLICATIONS THAT YOU SEE IN A STORE/RESTAURANT
ARE COMPLETELY WRITTEN IN JAVA.
INFORMATION TECHNOLOGY:
JAVA IS DESIGNED TO SOLVE IMPLEMENTATION DEPENDENCIES.
What is Java Used for?
ANDROID:
APPLICATIONS ARE EITHER WRITTEN IN JAVA OR USE JAVA
API.
FINANCIAL SERVICES:
IT IS USED IN SERVER-SIDE APPLICATIONS.
STOCK MARKET:
TO WRITE ALGORITHMS AS TO WHICH COMPANY THEY
SHOULD INVEST IN.
What is Java Used for?

BIG DATA:
HADOOP MAPREDUCE FRAMEWORK IS WRITTEN USING JAVA.
SCIENTIFIC AND RESEARCH COMMUNITY:
TO DEAL WITH HUGE AMOUNT OF DATA.
2 Features of Java
FEATURES OF JAVA
SIMPLE
JAVA HAS MADE LIFE EASIER BY REMOVING ALL THE
COMPLEXITIES SUCH AS POINTERS, OPERATOR
OVERLOADING AS YOU SEE IN C++ OR ANY OTHER
PROGRAMMING LANGUAGE.
FEATURES OF JAVA
PORTABLE
JAVA IS PLATFORM INDEPENDENT WHICH MEANS
THAT ANY APPLICATION WRITTEN ON ONE
PLATFORM CAN BE EASILY PORTED TO ANOTHER
PLATFORM.
FEATURES OF JAVA
OBJECT-ORIENTED
EVERYTHING IS CONSIDERED TO BE AN “OBJECT”
WHICH POSSESS SOME STATE, BEHAVIOR AND ALL
THE OPERATIONS ARE PERFORMED USING THESE
OBJECTS.
FEATURES OF JAVA
SECURED
ALL THE CODE IS CONVERTED IN BYTECODE AFTER
COMPILATION, WHICH IS NOT READABLE BY A HUMAN.
AND JAVA DOES NOT USE AN EXPLICIT POINTER AND RUN
THE PROGRAMS INSIDE THE SANDBOX TO PREVENT ANY
ACTIVITIES FROM UNTRUSTED SOURCES.
IT ENABLES TO DEVELOP VIRUS-FREE, TAMPER-
FREE SYSTEMS/APPLICATIONS.
FEATURES OF JAVA
DYNAMIC
DYNAMIC: IT HAS THE ABILITY TO ADAPT TO
AN EVOLVING ENVIRONMENT WHICH
SUPPORTS DYNAMIC MEMORY ALLOCATION
DUE TO WHICH MEMORY WASTAGE IS
REDUCED AND PERFORMANCE OF THE
APPLICATION IS INCREASED.
FEATURES OF JAVA
DISTRIBUTED
JAVA PROVIDES A FEATURE WHICH HELPS TO
CREATE DISTRIBUTED APPLICATIONS. USING
REMOTE METHOD INVOCATION (RMI), A PROGRAM
CAN INVOKE A METHOD OF ANOTHER PROGRAM
ACROSS A NETWORK AND GET THE OUTPUT.
FEATURES OF JAVA
ROBUST
ROBUST: JAVA HAS A STRONG MEMORY
MANAGEMENT SYSTEM. IT HELPS IN ELIMINATING
ERROR AS IT CHECKS THE CODE DURING COMPILE
AND RUNTIME.
FEATURES OF JAVA
HIGH PERFORMANCE
JAVA ACHIEVES HIGH PERFORMANCE THROUGH
THE USE OF BYTECODE WHICH CAN BE EASILY
TRANSLATED INTO NATIVE MACHINE CODE. WITH
THE USE OF JIT (JUST-IN-TIME) COMPILERS, JAVA
ENABLES HIGH PERFORMANCE.
FEATURES OF JAVA
INTERPRETED
INTERPRETED: JAVA IS COMPILED TO BYTECODES,
WHICH ARE INTERPRETED BY A JAVA RUN-TIME
ENVIRONMENT.
FEATURES OF JAVA
MULTITHREADED
JAVA SUPPORTS MULTIPLE THREADS OF
EXECUTION (A.K.A., LIGHTWEIGHT PROCESSES),
INCLUDING A SET OF SYNCHRONIZATION
PRIMITIVES. THIS MAKES PROGRAMMING WITH
THREADS MUCH EASIER.
Structure of a Java
3 Program
Basic Structure of JA
CLASS DEFINITION

IT CONTAINS ALL THE PIECES OF THE PROGRAM


NECESSARY TO EXECUTE THE PROGRAM.
CLASS DEFINITION

Class name
class body

Class Body – is where attributes are


declared and methods are defined.
CLASS DEFINITION
ACCESS MODIFIER

PUBLIC – IS AN ACCESS MODIFIER THAT INDICATES THAT


THE CODE COULD BE ACCESSED BY ALL OBJECTS.
ACCESS MODIFIER - SPECIFIES THE CIRCUMSTANCES
IN WHICH CLASS COULD BE ACCESSED.
CLASS DEFINITION
KEYWORD

CLASS
IS A KEYWORD THAT INFORMS THE COMPILER
THAT YOU ARE DEFINING A CLASS. REFERS TO THE
ENTIRE PROGRAM.
METHOD DEFINITION

method header
method
body

A part of a java program that contains the logic to


perform a task.
METHOD DEFINITION

method modifier

Method Modifier – enables setting of properties for


the method. Means that the method is for class.
METHOD DEFINITION

void – means that the


method does not return a
value when it is called.
METHOD DEFINITION

Method Name

Method
Argument List
String – refers to a data type.
args – identifier to any string character.
“Hello World Program”
Example 1: (Printing a simple text)
“Hello World Program”
Welcome to Java Programming
Example 2: : (Multiple line of text)
\
• CALLED AS ESCAPE CHARACTER
• WHICH INDICATES THAT A SPECIAL
CHARACTER IS TO BE OUTPUT.
ESCAPE SEQUENCE

\n • newline

\t • horizontal tab

\\ • backslash

\” • double quote
COMMENTS

// - Single line comment

/* */ - Multiple-line comment
COMMENTS

September 13, 2021


Programming Errors in
4 Java
PROGRAMMING ERRORS
IN COMPUTER TERMS AN ERROR IS A
BUG THAT AFFECTS THE OUTPUT OF A
PROGRAM. IT MAY ALSO SIMPLY MEAN
AN INCORRECT STATEMENT WITHIN A
PROGRAM.
SYNTAX ERRORS
THESE ARE USUALLY TYPING ERRORS
SYNTAX – REFERS TO CODE STRUCTURE OR
GRAMMAR.
SEMANTIC ERRORS

UNRECOGNIZABLE CODE TO THE JAVA


COMPILER.
RUN-TIME ERRORS

ERRORS DISPLAYED DURING


PROGRAM EXECUTION
Error Error Message Method of Correction
Missing semi Invalid type Add a semi colon to the end of
colon expression the line.
Invalid
declaration
‘;’ expected
Missing ‘ ) ‘ expected Insert missing ) or }
punctuation
Incorrect number Invalid argument Add a comma between
of arguments arguments in an argument list
Incorrect file Public class must Make sure that class name and
name be define in a file file name are the same in
spelling and case
Incorrect usage of Missing term Correct operand error
mathematical
operator
QUESTIONS?
Thank you!
Credits

Special thanks to all the people who made and released


these awesome resources for free:
⊳ Presentation template by SlidesCarnival
⊳ Photographs by Unsplash
Additional References:

⊳ https://www.edureka.co/blog/what-is-java/
⊳ http://ecomputernotes.com/java/what-is-java-
language/types-of-java-programs
OUR LADY OF FATIMA UNIVERSITY
COLLEGE OF COMPUTER STUDIES

You might also like