Anda di halaman 1dari 25

Java Programming

COSC 450

Dr. Mohamad EL ABED

1 Spring 2014

Course text book & software


Paul Deitel and Harvey Deitel, Java How to Program, 9 / e NetBeans IDE (http://netbeans.org/)

Evaluation profile
Attendance, Assignments and Lab 1 Mid. Exam 2 Projects

Marks
20% 20% 30%

Final Exam

30%

Office: Block I 208 Office hours: Wednesday 02:00 04:00 E-mail: alabedma@rhu.edu.lb
2

Course objectives
Concept of Object-Oriented Programming OOP

Use of a high level programming language (Java) for the


systematic development of programs Data structures: Stacks and Queues To build desktop applications using the design principles of Graphical User Interface (GUI) Understand the notion of multithreading Introduction to Weka Library and machine learning algorithms
3

Syllabus
I. II. Introduction to Java Applications Control Statements

III. Arrays in Java IV. Documenting with Javadoc

V.

Introduction to Object-Oriented Programming (OOP)

VI. Object-Oriented Programming: Inheritance and Polymorphism VII. Graphical User Interface (GUI) Components

VIII. Introduction to Java Applets


IX. Java Multithreading X. Introduction to Weka Library
4

Java Programming
COSC 450

Dr. Mohamad EL ABED

Chapter I
Introduction to Java Applications
5

Chapter I - Objectives
To be able to write simple Java applications To be able to use input and output statements

To be able to use arithmetic operators


To be able to write decision-making statements To be able to use relational and equality operators

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
7

History of Java
Java is developed by James Gosling at Sun Microsystems and released in 1995 Java provides the capabilities for Object-Oriented

Programming (OOP)
C, C++ and Java are widely used in real life applications

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
9

Why Java?
Portable - Platform independent programming language

Pointer denial reduces chances of virulent programs


corrupting host Provides the capabilities of Object-Oriented Programming (OOP) Designed for network programming (i.e., sockets) Multi-threaded (i.e., multiple simultaneous tasks)

10

How it Works?

11

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
12

First Program in Java: Printing a Line Text

Output

13

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
14

Escape Sequences

15

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
16

Displaying a Text in a Dialog Box

Output

17

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
18

Another Java Application: Adding Integers

19

Another Java Application: Adding Integers


Output

20

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
21

Arithmetic

22

Chapter I - Outline
History of Java

Why Java and How it Works?


First Program in Java: Printing a Line of Text Escape Sequences Displaying Text in a Dialog Box Another Java Application: Adding Integers Arithmetic Decision Making: Equality and Relational Operators
23

Decision Making: Equality and Relational Operators

24

End of Chapter I

25