0% found this document useful (0 votes)
7 views

Lec 2 _ Intro to Java.pptx

Uploaded by

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

Lec 2 _ Intro to Java.pptx

Uploaded by

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

Dept.

of Electrical &
Computer Engineering (ECE)

CSE 215 : Programming Language II

Lec 2: Introduction to JAVA


Dr Ziaul Hossain
History
• Java was originally developed by Sun
Microsystems starting in 1991
– James Gosling
– Patrick Naughton
– Chris Warth
– Ed Frank
– Mike Sheridan
• This language was initially called Oak
• Renamed Java in 1995 after the coffee from
Indonesia

Dept. of Electrical & Computer


Date Slide 2
Engineering (ECE)
JAVA …

• A simple, object-oriented, distributed,


interpreted, robust, secure, architecture neutral,
portable, high-performance, multithreaded, and
dynamic language -- Sun Microsystems

• Object-Oriented
– No free functions
– All code belong to some class
– Classes arranged in a hierarchy or package structure
Dept. of Electrical & Computer
Date Slide 3
Engineering (ECE)
JAVA …

• Distributed
– Fully supports IPv4, with structures to support
IPv6
– Includes support for Applets: small programs
embedded in HTML documents
• Interpreted
– The program are compiled into Java Virtual
Machine (JVM) code called bytecode
– Each bytecode instruction is translated into
machine code at the time of execution
Dept. of Electrical & Computer
Date Slide 4
Engineering (ECE)
JAVA . . .

• Robust
– Java is simple : no pointers/stack concerns
– Exception handling
• try/catch/finally series allows for simplified error recovery
– Strongly typed language
• many errors caught during compilation
• Architecture Neutral
– Runs in both Windows and Linux based machines
– Runs in all configurations

Dept. of Electrical & Computer


Date Slide 5
Engineering (ECE)
Java: Platform Neutral

Dept. of Electrical & Computer


Date Slide 6
Engineering (ECE)
First Program

Dept. of Electrical & Computer


Date Slide 7
Engineering (ECE)
Second Program

Dept. of Electrical & Computer


Date Slide 8
Engineering (ECE)
If Example

Dept. of Electrical & Computer


Date Slide 9
Engineering (ECE)
For Example

Dept. of Electrical & Computer


Date Slide 10
Engineering (ECE)
Primitive Data Types

• int
• float
• double
• char
• boolean

Dept. of Electrical & Computer


Date Slide 11
Engineering (ECE)
Integers

byte b, c; short s;
short t;

int a;
int totalNum; long lightspeed;

Dept. of Electrical & Computer


Date Slide 12
Engineering (ECE)
Floating Point Types

Dept. of Electrical & Computer


Date Slide 13
Engineering (ECE)
Character Type

char letter;
16 bit sized

Dept. of Electrical & Computer


Date Slide 14
Engineering (ECE)
Example in Character

Dept. of Electrical & Computer


Date Slide 15
Engineering (ECE)
Boolean Example

Dept. of Electrical & Computer


Date Slide 16
Engineering (ECE)
Variable Declaration

Dept. of Electrical & Computer


Date Slide 17
Engineering (ECE)
Scope & Lifetime of a Variable

Dept. of Electrical & Computer


Date Slide 18
Engineering (ECE)
Scope & Lifetime of a variable

Dept. of Electrical & Computer


Date Slide 19
Engineering (ECE)
• End of Lecture 2

Dept. of Electrical & Computer


Date Slide 20
Engineering (ECE)

You might also like