Lecture 1 Introduction to Java
Lecture 1 Introduction to Java
IN2203
Fundamentals of
Programming (Java)
Instructor
Dr. Muhammad Waqar
[email protected]
Contents
01 Basics of Java
Programming in Java, Data types, variables
04 Arrays
Single and multi dimensional arrays
1
5/17/2020
Break up
Week Week Tests Week
1-2 3-5 6-8
Week 4
Assignment
Introduction Selection (15%) Loops
to Java and Statements,
Programming Math Class, Week 5
Basics Strings Class Quiz
(10%)
Break up
Week Week Week
Tests
9-10 11-12 13
Week 8
Assignment
Single and (15%)
Defining and Multi- Week 10 Final Exam
Calling dimensional Class Quiz (30%)
Methods Arrays (10%)
Week 11
Project (10%)
2
5/17/2020
Grading Scheme
Test Percentage
Attendance/Class Participation 10%
Assignments (2) (Week 4, 8) 30% (15% each)
Quizzes (2) (Week 5, 10) 20% (10% each)
Project (Week 11) 10%
Final Test (Week 13) 30%
Total 100%
Easy to change colors.
Grading
Marks Point Meaning
A (80-100%) 4 EXCELLENT: Outstanding performance
B (70-79%) 3 GOOD: Better than average achievement
C (60-69%) 2 SATISFACTORY: Achievement sufficient to enable the
student to progress in the course
D (50-59%) 1 MARGINAL: Minimum acceptable level of
achievement; Exception: for courses where the
passing grade is a “C”, a grade of “D” represents an
insufficient achievement; must repeat.
F (0-49%) 0 UNSATISFACTORY: Insufficient achievement; must
repeat. Student must consult with Program
Coordinator.
3
5/17/2020
Textbooks
Tests
1. Fundamentals of Programming using Java, 1st edition by Edward Currie (2006)
4
5/17/2020
INTRODUCTION
CHAPTER 1
10
10
5
5/17/2020
11
11
12
Computer Hardware
Essentially, modern computers consist of:
1. Main memory
12
6
5/17/2020
13
Computer Software
Operating System
• The collection of computer programs that control the interaction of
the user and the computer hardware is called the operating
system (OS): e.g.: UNIX, Windows, MAC-OS X
• The operating system of a computer is the software that is
responsible for directing all computer operations and managing all
computer resources.
Application Software
• Application programs are developed to assist a computer user in
accomplishing various tasks (i.e. word processing, financial
calculations etc.) e.g. Notepad, MSWord, MATLAB etc.
13
14
Computer Languages
• Developing new software requires writing lists of instructions for a
computer to execute.
• The language directly understood by a computer is called
machine language (or machine code) and is a collection of binary
numbers.
• For brevity Software developers rarely use the machine language
directly because:
1. It is not standardised – depends on the CPU
2. Difficult to use – long development times
However it does have some advantages
1. Faster execution
2. Requires less memory.
14
7
5/17/2020
15
High-level Languages
• To write programs that are independent of the CPU on which they will
be executed, software designers use high level languages, which
combine algebraic expressions and symbols taken from English.
15
16
Programming Languages
https://www.webopedia.com/TERM/H/high_level_language.html
16
8
5/17/2020
17
Execution Steps
https://thebittheories.com/levels-of-programming-languages-b6a38a68c0f2
17
18
18
9
5/17/2020
19
Problem Specification
Specifying the problem requirements allows you to:
To achieve this goal you may find you need more information from the
person who posed the problem.
19
20
Analysis
Analyzing the problem involves identifying the:
20
10
5/17/2020
21
Design
Designing the algorithm
1. Develop a list of steps called an algorithm to solve the problem
2. Verify that the algorithm solves the problem as intended. Writing the
algorithm is often the most difficult part of the problem-solving
process. Coding and algorithm is simple once you know the
programming language syntax
21
22
Implementation
Implementing the algorithm
22
11
5/17/2020
23
23
24
Maintenance
Maintaining and updating
24
12
5/17/2020
25
Development of C Language
• The creation of C language changed the way programming was
approached and thought about
• The creation of C was direct result of need of a structured, efficient
high level language that could replace assembly language
• C was first developed in 1970s by Dennis Ritchie
• C was formally standardized in 1989
• C++ is enhancement of C which supports Objected oriented
Programming (OOP) that helps organize large complex problems.
25
26
Development of Java
• Language innovation is driven by two factors: improvement in art of
Tests
programming and computing environment
• Java inherits the rich legacy of C and C++ and adds new features
required by current state of art systems
• Java offers features that streamline programming for a distributed
architecture
• Java was initially conceived in 1991 by a group of programmers at
Sun Microsystems and was initially called “Oak” but it was renamed
as Java in 1995.
26
13
5/17/2020
27
Purpose of Java
• C++ required a different compiler for each of these devices as these
Tests
had a different kind of CPU and compilers are expensive and time
consuming
• The primary motivation was the need to have a platform independent
language that could be used in consumer electronics, microwave,
toasters, remote control etc.
• The need for platform independent language increased after the
development of internet as internet connected devices consisted of
various types of computers, CPUs and operating systems.
• Internet caused Java programmers to switch from consumer
electronics to internet
27
28
28
14
5/17/2020
29
Java’s Success
• Java’s success lies in its adaptability to changing programming
environments Tests
• Java’s release cycles is about 1.5 years compared to 10 years for
other languages
• Java is more secure and portable
29
30
30
15
5/17/2020
31
31
32
32
16
5/17/2020
33
33
34
Using NetBeans
Tests
34
17
5/17/2020
35
Tests
35
36
Tests
36
18
5/17/2020
37
Tests
37
38
Tests
38
19
5/17/2020
39
Tests
39
40
Tests
40
20
5/17/2020
41
Tests
41
42
42
21
5/17/2020
43
Tests
43
44
Output of Build
Tests
44
22
5/17/2020
45
Running Program
Tests
45
46
Output of Run
Tests
46
23
5/17/2020
47
47
48
48
24
5/17/2020
49
The keyword void simply tells the compiler that main( ) does not return
a value.
49
50
main() method
50
25
5/17/2020
51
String args[ ]
51
52
Printing a statement
This line outputs the string “This is a simple Java program.” followed by
a new line on the screen.
52
26
5/17/2020
53
53
Thank You
54
27