SlideShare a Scribd company logo
Java Programming Course
Lecture1
Organization of the course
Java basics
Prof. Mohammed A.M. Ibrahim
Java Programming 1
Course objectives
• Knowledge and understanding of the principles
of object oriented programming,
• Knowledge of and experience with (the syntax
and semantics of) Java, including important parts
of the Java API,
• Knowledge of and experience with solving simple
problems by the design and implementation
object oriented programs.
Prof. Mohammed A.M. Ibrahim
Java Programming 2
Contents of the lectures (provisional)
1. Java basics
2. Selection, iteration
3. Methods, specification
4. Array’s, algorithms
5. Application of classes, UML class diagrams
6. Implementation of classes
7. Inheritance
8. AWT, Swing, Java Interfaces, Events
9. Exceptions, File IOJava
10. Database Connectivity and Networking Classes
11. Utility classes
12. Written examination
Prof. Mohammed A.M. Ibrahim
Java Programming 3
What is the purpose of a program? How does it operate?
Manipulating data: (storing data, retrieving data,
combining
data, transforming data, …).
Data is stored in memory, it is manipulated by a
cpu (central
processing unit)
12
13
14
15
16
17
Memory
+
CPU
1
2
Prof. Mohammed A.M. Ibrahim
Java Programming
4
Low level language, high level language
Copy the contents of MEM13 to CPU1
Copy the contents of MEM15 to CPU2
Add the contents of CPU1 to the contents of CPU2
Copy the contents of CPU2 to MEM12
Low level statements:
MOV M13 C1
MOV M15 C2
ADD C1 C2
MOV C2 M12
High level statement:
som = getal1 + getal2;
Prof. Mohammed A.M. Ibrahim
Java Programming 5
Compilation of Pascal, C, C++, … programs.
Prof. Mohammed A.M. Ibrahim
Java Programming 6
Compilation and execution of a Java program
Prof. Mohammed A.M. Ibrahim
Java Programming 7
Tools for writing, compiling and executing Java programs
Texteditor => putting together the program text
Compiler => translation of program text to bytecode
Virtual machine => execution of bytecode
javac Hello.java //call of the compiler
java Hello //call of the virtual machine
Prof. Mohammed A.M. Ibrahim
Java Programming 8
Example program: class Hello
Text editor:
public class Hello{
public static void main(String[]
args){
System.out.println(“Hello”);
}
}
The file MUST be saved as: Hello.java
Prof. Mohammed A.M. Ibrahim
Java Programming 9
Result of the compilation and execution
Prof. Mohammed A.M. Ibrahim
Java Programming 10
Context, a Java Development Environment (IDE)
Prof. Mohammed A.M. Ibrahim
Java Programming 11
Class Hello
//example of a class structure
public class Hello{
//main method, driver of the program
public static void main(String[]
args){
//example of a (print)
statement
System.out.println(“Hello”);
}
}
Prof. Mohammed A.M. Ibrahim
Java Programming 12
Basic ingredients of Java
Data types: collection of data elements + operators
Integer numbers: int byte, short, long
Floating numbers: double float
Logic values: boolean
Letters, digits, writing & reading signs: char
Text: String
Prof. Mohammed A.M. Ibrahim
Java Programming 13
Datatype int
Data elements: -2147483648 t/m
+2147483647
operators: +, -, *, / and %
3 / 4 -> 0 3 % 4 -> 3
5 / 4 -> 1 5 % 4 -> 1
Integer division Modulo division
All elements of the interval are available.
Prof. Mohammed A.M. Ibrahim
Java Programming 14
Datatype double
Data-elements: -1.8 * 10+308
t/m -4.9 * 10-324
,
0,
+4.9 * 10-324
t/m +1.8 *
10+308
,
operators: +, -, *, /
3.0 / 4.0 -> 0.75
Floating point division
2 + 3.0 -> 5.0 automatic conversion
(double)2 + 3.0 -> 5.0 type cast
Prof. Mohammed A.M. Ibrahim
Java Programming 15
Storing data
During the execution of a program data is stored in
memory.
This data is retrieved and restored many times.
How much room is needed to store data?
At which location in the memory is the data stored?
How is data stored?
How is data retrieved?
Prof. Mohammed A.M. Ibrahim
Java Programming 16
Declaration of an int-variabele
int score;
A memory cell is allocated to store 1 int value.
The location of the memory cell is not available (hidden).
The memory cell is identified by the name of the variable
score
Prof. Mohammed A.M. Ibrahim
Java Programming 17
Assignment operator =
public static void main(String[] args){
int x;
x = 10;
double d;
d = 34.67;
String s;
s = “abcd”;
}
Prof. Mohammed A.M. Ibrahim
Java Programming 18
Application of memory locations
public static void main(String[] args){
int count; //creation of the
variable
count = 23; //storing data
System.out.print(count);
//retrieving, printing
count = count + 1; //retrieving,
storing
System.out.println(count); //
retrieving, storing
}
Prof. Mohammed A.M. Ibrahim
Java Programming 19
Application of memory locations (continued)
public static void main(String[] args){
//creation, storing
double average = 4.5;
//retrieving, storing
average = average + 3.4;
//creation, storing
String name = “Ali”;
//retrieving, storing
name = name + “alHassany”;
}
Prof. Mohammed A.M. Ibrahim
Java Programming 20
Writing data: print() and println()
System.out.print(3);
System.out.println(13.5);
System.out.print(“The count is: “);
System.out.println(count);
System.out.println(3 * 4.5);
System.out.println(“Name:” + “Ali”);
System.out.println(“Count: “ + count);
System.out.println(“My name is: ” +
name);
Prof. Mohammed A.M. Ibrahim
Java Programming 21
Importing data: class Scanner
import java.util.*;
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
double average = sc.nextDouble();
String name = sc.next();
Prof. Mohammed A.M. Ibrahim
Java Programming 22
Example program
import java.util.*;
public class Example{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println(“Type an int-number:
“);
int number = sc.nextInt();
System.out.println(“The number is “ +
number);
}
}
Prof. Mohammed A.M. Ibrahim
Java Programming 23

More Related Content

Similar to Lecture_1_Java_Programming_2023tttttttttt.ppt (20)

PPT
Programming with Java - Essentials to program
leaderHilali1
 
PPT
CSL101_Ch1.ppt Computer Science
kavitamittal18
 
PPT
Programming with Java by Faizan Ahmed & Team
FaizanAhmed272398
 
PPT
Introduction to java programming with Fundamentals
rajipe1
 
PPSX
DITEC - Programming with Java
Rasan Samarasinghe
 
PPTX
JAVA CLASS PPT FOR ENGINEERING STUDENTS BBBBBBBBBBBBBBBBBBB
NagarathnaRajur2
 
PPTX
Learning core java
Abhay Bharti
 
PPTX
Unit-1_GHD.pptxguguigihihihihihihoihihhi
40NehaPagariya
 
PPTX
Java (1).ppt seminar topics engineering
4MU21CS023
 
PPTX
Java platform
Visithan
 
PPTX
chapter 1-overview of java programming.pptx
nafsigenet
 
PPT
CSL101_Ch1.ppt
kavitamittal18
 
PPT
CSL101_Ch1.ppt
DrPriyaChittibabu
 
PPTX
CSL101_Ch1.pptx
shivanka2
 
PPTX
CSL101_Ch1.pptx
Ashwani Kumar
 
PPT
a basic java programming and data type.ppt
GevitaChinnaiah
 
PPT
Chapter 1 java
ahmed abugharsa
 
PPTX
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
PPTX
java in Aartificial intelligent by virat andodariya
viratandodariya
 
PPTX
JAVA in Artificial intelligent
Virat Andodariya
 
Programming with Java - Essentials to program
leaderHilali1
 
CSL101_Ch1.ppt Computer Science
kavitamittal18
 
Programming with Java by Faizan Ahmed & Team
FaizanAhmed272398
 
Introduction to java programming with Fundamentals
rajipe1
 
DITEC - Programming with Java
Rasan Samarasinghe
 
JAVA CLASS PPT FOR ENGINEERING STUDENTS BBBBBBBBBBBBBBBBBBB
NagarathnaRajur2
 
Learning core java
Abhay Bharti
 
Unit-1_GHD.pptxguguigihihihihihihoihihhi
40NehaPagariya
 
Java (1).ppt seminar topics engineering
4MU21CS023
 
Java platform
Visithan
 
chapter 1-overview of java programming.pptx
nafsigenet
 
CSL101_Ch1.ppt
kavitamittal18
 
CSL101_Ch1.ppt
DrPriyaChittibabu
 
CSL101_Ch1.pptx
shivanka2
 
CSL101_Ch1.pptx
Ashwani Kumar
 
a basic java programming and data type.ppt
GevitaChinnaiah
 
Chapter 1 java
ahmed abugharsa
 
LECTURE 2 -Object oriented Java Basics.pptx
AOmaAli
 
java in Aartificial intelligent by virat andodariya
viratandodariya
 
JAVA in Artificial intelligent
Virat Andodariya
 

Recently uploaded (20)

PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
Design Thinking basics for Engineers.pdf
CMR University
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Hashing Introduction , hash functions and techniques
sailajam21
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
Ad

Lecture_1_Java_Programming_2023tttttttttt.ppt

  • 1. Java Programming Course Lecture1 Organization of the course Java basics Prof. Mohammed A.M. Ibrahim Java Programming 1
  • 2. Course objectives • Knowledge and understanding of the principles of object oriented programming, • Knowledge of and experience with (the syntax and semantics of) Java, including important parts of the Java API, • Knowledge of and experience with solving simple problems by the design and implementation object oriented programs. Prof. Mohammed A.M. Ibrahim Java Programming 2
  • 3. Contents of the lectures (provisional) 1. Java basics 2. Selection, iteration 3. Methods, specification 4. Array’s, algorithms 5. Application of classes, UML class diagrams 6. Implementation of classes 7. Inheritance 8. AWT, Swing, Java Interfaces, Events 9. Exceptions, File IOJava 10. Database Connectivity and Networking Classes 11. Utility classes 12. Written examination Prof. Mohammed A.M. Ibrahim Java Programming 3
  • 4. What is the purpose of a program? How does it operate? Manipulating data: (storing data, retrieving data, combining data, transforming data, …). Data is stored in memory, it is manipulated by a cpu (central processing unit) 12 13 14 15 16 17 Memory + CPU 1 2 Prof. Mohammed A.M. Ibrahim Java Programming 4
  • 5. Low level language, high level language Copy the contents of MEM13 to CPU1 Copy the contents of MEM15 to CPU2 Add the contents of CPU1 to the contents of CPU2 Copy the contents of CPU2 to MEM12 Low level statements: MOV M13 C1 MOV M15 C2 ADD C1 C2 MOV C2 M12 High level statement: som = getal1 + getal2; Prof. Mohammed A.M. Ibrahim Java Programming 5
  • 6. Compilation of Pascal, C, C++, … programs. Prof. Mohammed A.M. Ibrahim Java Programming 6
  • 7. Compilation and execution of a Java program Prof. Mohammed A.M. Ibrahim Java Programming 7
  • 8. Tools for writing, compiling and executing Java programs Texteditor => putting together the program text Compiler => translation of program text to bytecode Virtual machine => execution of bytecode javac Hello.java //call of the compiler java Hello //call of the virtual machine Prof. Mohammed A.M. Ibrahim Java Programming 8
  • 9. Example program: class Hello Text editor: public class Hello{ public static void main(String[] args){ System.out.println(“Hello”); } } The file MUST be saved as: Hello.java Prof. Mohammed A.M. Ibrahim Java Programming 9
  • 10. Result of the compilation and execution Prof. Mohammed A.M. Ibrahim Java Programming 10
  • 11. Context, a Java Development Environment (IDE) Prof. Mohammed A.M. Ibrahim Java Programming 11
  • 12. Class Hello //example of a class structure public class Hello{ //main method, driver of the program public static void main(String[] args){ //example of a (print) statement System.out.println(“Hello”); } } Prof. Mohammed A.M. Ibrahim Java Programming 12
  • 13. Basic ingredients of Java Data types: collection of data elements + operators Integer numbers: int byte, short, long Floating numbers: double float Logic values: boolean Letters, digits, writing & reading signs: char Text: String Prof. Mohammed A.M. Ibrahim Java Programming 13
  • 14. Datatype int Data elements: -2147483648 t/m +2147483647 operators: +, -, *, / and % 3 / 4 -> 0 3 % 4 -> 3 5 / 4 -> 1 5 % 4 -> 1 Integer division Modulo division All elements of the interval are available. Prof. Mohammed A.M. Ibrahim Java Programming 14
  • 15. Datatype double Data-elements: -1.8 * 10+308 t/m -4.9 * 10-324 , 0, +4.9 * 10-324 t/m +1.8 * 10+308 , operators: +, -, *, / 3.0 / 4.0 -> 0.75 Floating point division 2 + 3.0 -> 5.0 automatic conversion (double)2 + 3.0 -> 5.0 type cast Prof. Mohammed A.M. Ibrahim Java Programming 15
  • 16. Storing data During the execution of a program data is stored in memory. This data is retrieved and restored many times. How much room is needed to store data? At which location in the memory is the data stored? How is data stored? How is data retrieved? Prof. Mohammed A.M. Ibrahim Java Programming 16
  • 17. Declaration of an int-variabele int score; A memory cell is allocated to store 1 int value. The location of the memory cell is not available (hidden). The memory cell is identified by the name of the variable score Prof. Mohammed A.M. Ibrahim Java Programming 17
  • 18. Assignment operator = public static void main(String[] args){ int x; x = 10; double d; d = 34.67; String s; s = “abcd”; } Prof. Mohammed A.M. Ibrahim Java Programming 18
  • 19. Application of memory locations public static void main(String[] args){ int count; //creation of the variable count = 23; //storing data System.out.print(count); //retrieving, printing count = count + 1; //retrieving, storing System.out.println(count); // retrieving, storing } Prof. Mohammed A.M. Ibrahim Java Programming 19
  • 20. Application of memory locations (continued) public static void main(String[] args){ //creation, storing double average = 4.5; //retrieving, storing average = average + 3.4; //creation, storing String name = “Ali”; //retrieving, storing name = name + “alHassany”; } Prof. Mohammed A.M. Ibrahim Java Programming 20
  • 21. Writing data: print() and println() System.out.print(3); System.out.println(13.5); System.out.print(“The count is: “); System.out.println(count); System.out.println(3 * 4.5); System.out.println(“Name:” + “Ali”); System.out.println(“Count: “ + count); System.out.println(“My name is: ” + name); Prof. Mohammed A.M. Ibrahim Java Programming 21
  • 22. Importing data: class Scanner import java.util.*; Scanner sc = new Scanner(System.in); int count = sc.nextInt(); double average = sc.nextDouble(); String name = sc.next(); Prof. Mohammed A.M. Ibrahim Java Programming 22
  • 23. Example program import java.util.*; public class Example{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println(“Type an int-number: “); int number = sc.nextInt(); System.out.println(“The number is “ + number); } } Prof. Mohammed A.M. Ibrahim Java Programming 23