OOP - Lecture02 - Introduction to Java.pptx

umairmushtaq48 11 views 23 slides May 02, 2024
Slide 1
Slide 1 of 23
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23

About This Presentation

It is introduction of java for beginners


Slide Content

Lecture 02 Introduction to Java

Lecture Outline Evolution of Programming Languages Why Java? Java History Java Versions Java Features Java Procedure Revision of Programming Fundamentals Topics

What is a Program? A computer program is a sequence of instructions written to perform a specified task for a computer.

The Evolution of Programming Language Machine Language: 1940’s Assembly Language: Early 1950’s Higher-Level Languages: Late 1950’s Fortran: scientific computation COBOL: business data processing Lisp: symbolic computation Today: Thousands of programming languages available

What is Programming? When we say “programming” we are actually referring to the science of transforming our intentions in a high-level programming language.

What is this course about? Learn programming in a high-level programming language. Programming has many paradigms Procedural Object-Oriented We will study Object-Oriented Programming using ‘Java’, a popular high-level object-oriented programming language.

Non-structured Programming e.g. Assembly Language, BASIC Advantages Low Level access High Optimization Shorter size programs Disadvantages Large programs highly complex Difficult to understand Repetition of code a 100 mov ax,0002 mov bx,0004 add ax,bx nop

Procedural/Structured Programming e.g. C, Pascal Advantages Fast execution Small memory footprint (Size) Disadvantages Limited in Enhancement over the time Low reusability Difficult to Extended Less Dynamic architecture

Object Oriented Programming e.g. C++, C#, Java etc Disadvantages Little Slow execution Little Big memory footprint (Size) Advantages Better Enhancement over the time High reusability Easy to Extended Better representation of real world problems

Why Java? It’s the current “hot” language Java mean “Cup of Coffee” It’s almost entirely object-oriented It has a vast library of predefined objects and operations It’s more platform independent This makes it great for web programming too (but that is beyond this course) It’s more secure It isn’t C++

Java History (1 of 3) created in 1991 by James Gosling et al. of Sun Microsystems. Initially called Oak, in honor of the tree outside Gosling's window, its name was changed to Java because there was already a language called Oak.

Java History (2 of 3) The term Java actually refers to more than just a particular language like C or Pascal. Java encompasses several parts, including: A high level language – Java language is a high level one that at a glance looks very similar to C and C++ but offers many unique features of its own. Java bytecode – A compiler, such as Sun's javac , transforms the Java language source code to bytecode that runs in the JVM. Java Virtual Machine (JVM) – a program, such as Sun's java, that runs on a given platform and takes the bytecode programs as input and interprets them just as if it was a physical process executing machine code.

Java History (3 of 3) Sun provides a set of programming tools such as javac , java and others in a bundle that it calls a Java Software Development Kit for each version of the language for different platforms such as Windows, Linux, etc. Sun also provides a runtime bundle with just the JVM when the programming tools are not needed.

Java Versions (1 of 2) Since its introduction in 1995, Sun has released a new version of the Java language every two years or so. These new versions brought enhancements, new capabilities and fixes to bugs. Till 2002, the versions were numbered 1.x, where x reached up till 4. (Intermediate revisions were labeled with a third number - 1.x.y - as in 1.4.2.) After that all the versions were released with a whole number such as 5.0 or 6. The current version of Java is Java SE 17 (LTS) where SE refers to Standard Edition (used for targeting workstations) and the LTS refers to Long Term Support. Not all Java versions have LTS, so far only 3 have been released (2008, 2018 and 2021) Another newer version of Java SE 18 is expected to be released in March 2022

Java Versions (2 of 2) The major editions of Java are: Java Card (for smart cards) Java Micro Edition (for limited resources environments) Java Standard Edition (for workstations) Java Enterprise Edition (for enterprises and internet environments)

Java Features Simple & Secure Object-Oriented Robust Restricts the programmer to find the mistakes early Performs compile-time (strong typing) and run-time (exception-handling) checks Manages memory automatically Multithreaded Architecture-Neutral Interpreted and High-Performance Distributed Dynamic

Java Procedure The essential steps to creating and running Java programs go as follows: Create a Java source code file Compile the source code Run the compiled code in any Java Virtual Machine.

Java Program Execution

Java Program Execution Manual – with text editor (notepad) Create the Java source code files (*.java) Use Command Line tools in the Java Software Development Kit (SDK). The SDK is provided by Sun for several platforms and includes a number of tools, the most important of which are: javac – compiles Java source code files java – runs Java application programs appletviewer – tests applets independently of a browser Integrated Development Environment (IDE) NetBeans Borland JBuilder Eclipse Dr Java IntelliJ IDEA (My Favorite)

Revision (1 of 3) Decision Making Statements If-else Switch Case Loops For While Do-While Nested {{}}

Revision (2 of 3) Variables Strings in C/C++ Arrays 1D 2D ND

Revision (3 of 3) Functions / Methods Declaration Definition Calling Overloading Passing Arguments By Value By reference in java?

Thank You  Any Questions?