0% found this document useful (0 votes)
74 views30 pages

University of Hargeisa: Course: Computer Programming I (Java)

This document provides an introduction to the Java programming language presented in a university course. It covers key topics like the definition of a programming language, types of languages, how Java runs, the Java environment, problem solving in programming, popular Java applications, editors used for Java, and characteristics of Java like being object-oriented and platform independent. It also discusses concepts like classes, objects, methods, and different types of errors in programming.

Uploaded by

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

University of Hargeisa: Course: Computer Programming I (Java)

This document provides an introduction to the Java programming language presented in a university course. It covers key topics like the definition of a programming language, types of languages, how Java runs, the Java environment, problem solving in programming, popular Java applications, editors used for Java, and characteristics of Java like being object-oriented and platform independent. It also discusses concepts like classes, objects, methods, and different types of errors in programming.

Uploaded by

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

UNIVERSITY OF HARGEISA

Course: Computer Programming I (Java)

Lecture One

Presented by:
Sahardiid Ahmed Ali
Chapter 1
Introduction to Java

Chapter 1 Slide 2
Learning Objectives
At the end of the lesson student should be able to:-

 Define Programming Language


 Explain Types of Programming Language.
 Describe Java Running Process.
 Java Environment
 Problem Solving
 Java Applications
 Popular Java Editors
 Characteristices of Java

Chapter 1 Slide 3
Introduction

Programming Language is a set of instructions that perform a


specific task when executed by a computer .

The objective of programming language is to solve the


mathematical operations.
All programming are same ,but the different is syntax only.
Java programming language was originally developed by Sun
Microsystems which was initiated by James Gosling and released in
1995 as core component of Sun Microsystems' Java platform.

Chapter 1
Slide 4
Types of Programming Language

Programming Language divided into two types

1. High Level Language

2. Low Level Language

Chapter 1 Slide 5
High Level Language

High Level Language

High-level languages, such as C++, Visual Basic and Java

High level language allows to write instructions look like English


Language or other Natural Languages with containing
commonly used mathematical expressions.

Chapter 1 Slide 6
Low Level Language

Low Level Language

Instructions directly understandable by computer or Machines,


low level Languages very to understand by human.
Machine language supporting by numbers (1s and 0s).

Chapter 1 Slide 7
Java Running Process

High level language (Java)

Compiler

Low Level Language (Machine Code)

Chapter 1 Slide 8
Java is modern Programming language which apply different
Platform Applictions.

In the Java programming language:


A program is made up of one or more classes
A class contains one or more methods
A method contains program statements

Sun released the first public implementation as Java 1.0 in 1995.


It promised Write Once, Run Anywhere (WORA).

Chapter 1
Slide 9
The Java Environment

Chapter 1
Slide 10
Basic Program Development

Chapter 1
Slide 11
Problem Solving
The purpose of writing a program is to solve a problem

Solving a problem consists of multiple activities:


Understand the problem
Design a solution
Consider alternatives and refine the solution
Implement the solution
Test the solution

These activities are not purely linear – they overlap


and interact

Chapter 1
Slide 12
Java Applications

1. Web Applications (Java Applets)

2. Desktop Applications

3. Client/Server App

4. Mobile Applications

5. Game Applications

Chapter 1 Slide 13
Popular Java Editors

Notepad: On Windows machine, you can use any simple text


editor like Notepad

Netbeans: A Java IDE that is open-source and free, which


can be downloaded from
http://www.netbeans.org/index.html.

Eclipse: A Java IDE developed by the eclipse open-source


community and can be downloaded from
http://www.eclipse.org/.\

Chapter 1
Slide 14
Characteristices of Java

1. Java is simple
2. Java Virtual Machine(JVM)
3. Java is OOP
4. Platform Independent
5. Java dependent class libraries
6. Java is Portable
7. Java is Secure
8. Etc.

Chapter 1
Slide 15
Characteristices of Java
Java Virtual Machine(JVM)
Java Virtual Machine (JVM) is a special environment for Java that translates
programs into machine language, making Java a platform independent of
operating systems.

Object-Oriented Programming (OOP)


OOP is a programming paradigm that uses objects to solve problems .
OOP is a modern paradigm that is object-based.
In programming, anything must be an object, which has its own set of
properties, methods, and functions.

OOP is a programming methodology that views a program as similarly


consisting of objects that can act alone or interact with one another.

Chapter 1
Slide 16
Characteristices of Java
Platform Independent
Every operating system has its own Java Virtual Machine(JVM),
and the same software can run on multiple operating systems.

Java dependent class libraries


It is necessary to download the JDK (Java Development Kit),
which is a Java-dependent class library which includes file
classes, database classes, network classes, 3D classes, and
animation classes.

Chapter 1
Slide 17
Characteristices of Java
Java is Portable
java code that is written on one machine can run on another
machine. The platform independent byte code can be carried to
any platform for execution that makes java code portable.

Java is Secure
With Java's secure feature it enables to develop virus-free,
tamper-free systems. Authentication techniques are based on
public-key encryption.

Chapter 1
Slide 18
Methods for writing java Programs

1. JDK (Java Development Kit)


2. IDE(Integrated Development Environment) means
NetBeans,Jdeveloper and Jbuilder.

JDK (Java Development Kit) includes the fallowing files:-


3. javac.exe
4. java.exe
5. appletviewer.exe

Chapter 1
Slide 19
Methods for writing java Programs

Javac.exe is an executable file that is used to translate source


code to execute.
myProg.java-->myProg.class

Java.exe is responsible for execution After converting to a file


form called.class.
myProg.class-->Run

Appletviewer.exe is used to view or display Java Applets during


development process

Chapter 1
Slide 20
Installing of JDK Setup

1. Open My Computer
2. Go to C partation
3. Go Program Files
4. Go to Java File jdk1-15.0.2
5. Go to Bin
Then we will get the necessary files which was discussed before.
 Javac.exe
 Java.exe
 Appletviewer.exe

Chapter 1
Slide 21
Installing of JDK Setup

• Copy the path (C:\Program Files\Java\jdk-15.0.2\bin)


• Go my Computer
• Right Click
• Properties
• Advanced Setting
• Environment Variables
• Selecting Path
• Then Edit
• At the end ;

Chapter 1
Slide 22
Java Terminology

Object − Objects have states and behaviors. Example: A dog has


states - color, name, breed as well as behavior such as wagging
their tail, barking, eating. An object is an instance of a class.

Class − A class can be defined as a template/blueprint that


describes the behavior/state that the object of its type supports.
A class is a blueprint for objects

Methods − A method is basically a behavior. A class can contain


many methods. It is in methods where the logics are written,
data is manipulated and all the actions are executed.

Chapter 1
Slide 23
Java Terminology

Instance Variables − Each object has its unique set of instance


variables. An object's state is created by the values assigned to
these instance variables.

Algorithms is a set of instructions for solving a problem.


Algorithms usually are expressed in English or in pseudocode

Chapter 1
Slide 24
Java Terminology

Errors
• An error in a program is called a bug.
• Eliminating errors is called debugging.

Three kinds or errors


1. Syntax errors
2. Runtime errors
3. Logic errors

Chapter 1
Slide 25
Java Terminology

Syntax Errors
Grammatical mistakes in a program.
The grammatical rules for writing a program are very strict
The compiler catches syntax errors and prints an error message.
Example: using a period where a program
expects a comma

Chapter 1
Slide 26
Java Terminology

Runtime Errors
Errors that are detected when your program is running, but not
during compilation.
When the computer detects an error, it terminates the program
and prints an error message.
Example: attempting to divide by 0

Chapter 1
Slide 27
Java Terminology

Logic Errors
Errors that are not detected during compilation or while
running, but which cause the program to produce incorrect
results.
Example: an attempt to calculate a Fahrenheit temperature from
a Celsius temperature by multiplying by 9/5 and adding 23
instead of 32

Chapter 1
Slide 28
Any Question??

Chapter 1
Thanks

You might also like