01_Introduction
01_Introduction
COMP231
Advanced Programming
Welcome to COMP231,
one of the most
exciting
programming courses
offered at Computer
Science Department
1
6/24/2019
Course Description
In this course, you will learn
some of the concepts,
fundamental syntax, and
thought processes behind true
Object-Oriented Programming
(OOP)
Course Description
Upon completion of this course, you’ll be able to:
Demonstrate understanding of classes, constructors, objects,
and instantiation.
Access variables and modifier keywords.
Develop methods using parameters and return values.
Build control structures in an object-oriented environment.
Convert data types using API methods and objects.
Design object-oriented programs using scope, inheritance,
and other design techniques.
Create an object-oriented application using Java packages,
APIs. and interfaces, in conjunction with classes and objects.
2
6/24/2019
Logistics
Instructor: Mamoun Nawahdah (Masri314)
Text book:
Introduction To JAVA Programming, 11th edition.
Author: Y. Daniel Liang.
Publisher: Prentice Hall.
Lab Manual:
Title: LABORATORY WORK BOOK (COMP231 –
2017/2018)
Special Regulations
Assignments:
All assignments are individual efforts any
duplicated copies will be treated as a cheating
attempt which lead to ZERO mark.
Using code from the internet will be treated
as cheating as well.
The assignments should be submitted
through Ritaj within the specified deadline.
No late submissions are accepted even by 1
minute after the deadline.
3
6/24/2019
Grading Criteria
4
6/24/2019
Course Outline
Lab Outline
5
6/24/2019
6
6/24/2019
Why Java?
Java is a general
purpose programming
language.
Java is the Internet
programming
language.
14
7
6/24/2019
Characteristics of Java
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-Neutral
Java Is Portable
Java's Performance
Java Is Multithreaded
Java Is Dynamic 16
8
6/24/2019
JDK Versions
JDK 1.02 (1995)
JDK 1.1 (1996)
JDK 1.2 (1998)
JDK 1.3 (2000)
JDK 1.4 (2002)
JDK 1.5 (2004) a. k. a. JDK 5 or Java 5
JDK 1.6 (2006) a. k. a. JDK 6 or Java 6
JDK 1.7 (2011) a. k. a. JDK 7 or Java 7
JDK 8 (2014)
JDK 10 (March 2018)
JDK 11 (September 2018)
JDK 12 (March 2019) 17
JDK Editions
Java Standard Edition (J2SE)
J2SE can be used to develop client-side standalone
applications or applets.
Java Enterprise Edition (J2EE)
J2EE can be used to develop server-side applications
such as Java servlets, Java ServerPages, and Java
ServerFaces.
Java Micro Edition (J2ME).
J2ME can be used to develop applications for mobile
devices such as cell phones.
18
9
6/24/2019
19
20
10
6/24/2019
21
22
11
6/24/2019
12
6/24/2019
Class Name
Every Java program must have at least one class.
Each class has a name.
By convention, class names start with an
uppercase letter.
In this example, the class name is Welcome.
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
} 25
Main Method
In order to run a class, the class must
contain a method named main.
The program is executed from the main
method.
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
26
13
6/24/2019
Statement
A statement represents an action or a sequence
of actions.
The statement
System.out.println("Welcome to Java!")
in the program is a statement to display the
greeting “Welcome to Java!”.
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
} 27
Statement Terminator
Every statement in Java ends with a semicolon
;
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
28
14
6/24/2019
Reserved Words
Reserved words or keywords are words that have a
specific meaning to the compiler and cannot be used for
other purposes in the program.
For example, when the compiler sees the word class,
it understands that the word after class is the name for
the class.
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
29
15
6/24/2019
Naming Conventions
Choose meaningful and
descriptive names.
Class names:
Capitalize the First Letter of
each word in the name. For
example, the class name
ComputeExpression.
31
32
16
6/24/2019
Block Styles
33
Programming Errors
Syntax Errors
Detected by the compiler
Runtime Errors
Causes the program to abort
Logic Errors
Produces incorrect result
34
17