0% found this document useful (0 votes)
10 views17 pages

01_Introduction

COMP231 is an advanced programming course focused on Object-Oriented Programming (OOP) concepts and Java. Students will learn about classes, methods, control structures, and design techniques, with a strict policy on individual assignments and attendance. The course includes a midterm, final exam, and various projects, with a grading breakdown of 30% midterm, 35% final, and 35% dojo.

Uploaded by

bader shkereh
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)
10 views17 pages

01_Introduction

COMP231 is an advanced programming course focused on Object-Oriented Programming (OOP) concepts and Java. Students will learn about classes, methods, control structures, and design techniques, with a strict policy on individual assignments and attendance. The course includes a midterm, final exam, and various projects, with a grading breakdown of 30% midterm, 35% final, and 35% dojo.

Uploaded by

bader shkereh
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/ 17

6/24/2019

COMP231
Advanced Programming

By: Mamoun Nawahdah (Ph.D.)


2018/2019

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

Special Class Regulations


 Attendance is mandatory. University regulations
will be strictly enforced.
 Mobile: Keep it off during the class. If your
mobile ring you have to leave the classroom
quickly, quietly and don’t come back.
 Late: you are expected to be in the classroom
before the teacher arrival. After 5 minutes you
will not allowed entering the classroom.

Grading Criteria

 Midterm exam 30%


 Final exam 35%
 Dojo 35%
(Project: 4 Phases, Quizzes, Practical, Participation)

4
6/24/2019

Course Outline

Lab Outline

5
6/24/2019

Interpreting/Compiling Source Code


 A program written in a high-level language
is called a source program or source code.
 Because a computer cannot understand a
source program, a source program must be
translated into machine code for execution.
 The translation can be done using another
programming tool called an interpreter or a
compiler.

Interpreting Source Code


 An interpreter reads one statement from the
source code, translates it to the machine code or
virtual machine code, and then executes it right
away, as shown in the following figure.

 Note that a statement from the source code may


be translated into several machine instructions.

6
6/24/2019

Compiling Source Code


 A compiler translates the entire source
code into a machine-code file, and the
machine-code file is then executed, as
shown in the following figure.

Why Java?
 Java is a general
purpose programming
language.
 Java is the Internet
programming
language.

14

7
6/24/2019

Java, Web, and Beyond


 Java can be used to develop standalone
applications.
 Java can be used to develop applications
running from a browser.
 Java can also be used to develop
applications for hand-held devices.
 Java can be used to develop applications
for Web servers.

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

Popular Java IDEs


IDE  Integrated Development Environment

19

A Simple Java Program


// This program prints Welcome to Java!
public class Welcome
{
public static void main(String[] args)
{
System.out.println("Welcome to Java!");
}
}

20

10
6/24/2019

Creating and Editing Using NotePad


To use NotePad, type:
notepad Welcome.java
from the DOS prompt.

21

Creating, Compiling, and Running Programs

22

11
6/24/2019

Compiling and Running Java from


the Command Window (cmd)
 Set path to JDK bin directory
set path=c:\Program Files\java\jdk1.8.0_xx\bin
 Set classpath to include the current directory
set classpath=.
 Compile:
javac Welcome.java
 Run:
java Welcome
23

Anatomy of a Java Program


 Class name
 Main method
 Statements
 Statement terminator
 Reserved words
 Comments
 Blocks
24

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

Programming Style and


Documentation
 Appropriate Comments.
 Naming Conventions.
 Proper Indentation and Spacing
Lines.
 Block Styles.
30

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

Proper Indentation and


Spacing
 Indentation
 Indent two spaces.
 Spacing
 Use blank line to separate
segments of the code.

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

You might also like