+ All Categories
Home > Documents > 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

1 The JAVA Language Object Oriented Technology Mithani Binjan M.

Date post: 18-Jan-2016
Category:
Upload: jodie-rice
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
25
1 The JAVA Language Object Oriented Technology Mithani Binjan M
Transcript
Page 1: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

1

The

JAVA Language

Object Oriented

Technology

Mithani Binjan M

Page 2: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

2

Programming Languages

•To adapt to changing environments and uses•To implement

refinements and improvements

in the art of programming

Page 3: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

3

History of OOPs In 1960s Birth of Structured

Programming Language

In early 1980s object-oriented

programming (OOP)

Page 4: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

4

History of OOPs In 1979 C++ invented by

Bjarne Stroustrup 1980s and the early 1990s,

C++ took hold.

Page 5: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

5

History of OOPs In 1991 Java was conceived

By James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan

At Sun Microsystems, Inc.

“Oak” “Java” (1995)

Page 6: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

6

Java the Language of Internet

Expanded the universe of objects Objects can move about freely

in cyberspace. On a network :

passive information/data dynamic, active programs

Page 7: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

7

Java Applications -&- Java Applets

An application is a program that runs on your computer, under the operating system of that computer. An applet is an application designed to be transmitted over the Internet and executed by a Java-compatible Web browser.

Page 8: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

8

Java’s Magic: The Bytecode

An application a highly optimized set of instructions designed to be executed by the Java run-time system - JVM JVM - Java Virtual Machine Truly Portable

Page 9: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

9

JVM Interpreter JVM needs to be implemented for each

platform. Platform independent Bytecode enables the Java run-time system to execute programs much faster

Page 10: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

10

Just In Time (JIT) compiler

Sun supplies its Just In Time (JIT) compiler for bytecode. (Java-2) JIT compiler is part of the JVM. It compiles bytecode into executable code in real time, on a piece-by-piece, demand basis.

Page 11: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

11

Java Buzzwords SimpleSecurePortableObject-orientedRobust

MultithreadedArchitecture-neutralInterpretedHigh performanceDistributedDynamic

Page 12: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

12

Java Versions Java 1.0Java 1.1Java 2Java 2, version 1.2Java 2, version 1.3

Java 2, version 1.4Java 2, version 1.5 Java 2, version 1.6

Page 13: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

13

Java the OOP Language The Three OOP Principles

• Encapsulation

• Inheritance

• Polymorphism

Abstraction

Page 14: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

14

Encapsulation

getB( )

A B

getA()

Page 15: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

15

InheritanceBird

Flying Non-Flying

Robin Swallow Penguin Kiwi

Page 16: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

16

PolymorphismShape

Draw( )

Draw( a, b ) Draw( a ) Draw( a, b, c )

Rectangle Circle Triangle

Page 17: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

17

Object• Run time entity

• Represent a PERSON, BOOK,

Bank Account, etc…

• User defined data

• Example:

Object : StudentDATA: Roll_no Name Percentage

FUNCTIONS: Total Average Display

Page 18: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

18

Class• Set of Data & Code is class

•User defined data-type

• Example: Fruit, Furniture Vehicle

CLASS

DATA: ::::::::::::: :::::::::::::

FUNCTIONS: :::::::::::: ::::::::::::

Page 19: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

19

Variables & Data Types• Named memory location that holds a value

• In java variables must be declared before it use in the program

• Variable must be of some datatype, it tells

compiler what type of value it can store

Page 20: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

20

Data Types• Java supports eight different basic data types.

TypeSize in bytes

Description Keyword

Character 2 16-bit Unicode

char

Boolean - true / false 1-bit boolean

Byte 1 8-bit byteShort 2 16-bit shortInteger 4 32-bit int

Long 8 64-bit longFloat 4 32-bit floatDouble 8 64-bit double

Page 21: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

21

Declaration & Initialization of variable

Datatype varName; // Declaration of Variable

varName = Value;

Example:

int count = 22;

Page 22: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

22

Declaration & Initialization of variable

float x, y, z;

// value here considers as ‘double’ type

x = 10.35;

x = 10.35f;

y = 24.56F;

z = y;

Page 23: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

23

Declaration & Initialization of variable

long m = 254836L; 

System.out.println(“The value of m is “ + m);

Output:

The value of m is 254936

Page 24: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

24

Declaration & Initialization of variable

Character & Strings

 char ch = ‘A’;

 String s1= “This is Testing”;

//String is a class provide by Java.

Page 25: 1 The JAVA Language Object Oriented Technology Mithani Binjan M.

25

Guess the OutputClass test

{

public static void main(String s[])

{

char c;

boolean flg;

int a;

System.out.println(c);

System.out.println(flg);

System.out.println(a);

}

}


Recommended