SlideShare a Scribd company logo
1 of 49
Java Evolution
 Java Introduction
 Java Features
 How Java Differs from other OO languages
1RAJESHREE KHANDE
Java - An Introduction
 Java - The new programming language developed by
Sun Microsystems (James Gosling) in 1991.
 Originally called Oak.
 Java Authors: James Gosling, Arthur Van Hoff, Andy
Bechtolsheim
 A general-purpose object-oriented language.
 Designed for easy Web/Internet applications
2RAJESHREE KHANDE
Java - An Introduction
 Originally created for consumer electronics (TV, VCR,
Freeze, Washing Machine, Mobile Phone).
 Java - CPU Independent language
 Internet and Web was just emerging, so Sun turned it
into a language of Internet Programming.
 It allows you to publish a webpage with Java code in it.
3RAJESHREE KHANDE
Year Development
1990 Sun decided to developed special software that could be used for
electronic devices. A project called Green Project created and
head by James Gosling.
1991 Explored possibility of using C++, with some updates announced
a new language named “Oak”
1992 The team demonstrated the application of their new language to
control a list of home appliances using a hand held device.
1993 The World Wide Web appeared on the Internet and transformed
the text-based interface to a graphical rich environment. The team
developed Web applets (time programs) that could run on all
types of computers connected to the Internet.
Java Milestones
4RAJESHREE KHANDE
Java Milestones
Year Development
1994 The team developed a new Web browsed called
“Hot Java” to locate and run Applets. HotJava
gained instance success.
1995 Oak was renamed to Java, as it did not survive
“legal” registration. Many companies such as
Netscape and Microsoft announced their support for
Java
1996 Java established itself as both
1. “the language for Internet programming”
2. a general purpose OO language.
1997 A class libraries, Community effort and
standardization, Enterprise Java, Clustering, etc..
5RAJESHREE KHANDE
Java Features
 Familiar, Simple, Small
 Object-Oriented
 Platform-Independent and Portable
 Compiled and Interpreted
 Robust and Secure
 Distributed
 Multithreaded
 High Performance
 Dynamic and Extensible
6RAJESHREE KHANDE
Cont…
 Familiar, Simple & Small
 Java does not use Preprocessor header files,
goto statement and many others
 no pointers
 automatic garbage collection
 rich pre-defined class library
http://java.sun.com/j2se/1.4.2/docs/api/
7RAJESHREE KHANDE
Cont…
 Object-Oriented
 Focus on the data (objects) and methods
manipulating the data
 Almost every thing in Java is Object.
 All functions are associated with objects
 Almost all datatypes are objects (files, strings, etc.)
 Potentially better code organization and reuse
8RAJESHREE KHANDE
Cont…
 Platform-Independent and Portable
 Java is portable.
1) Java Complier generates bytecode that can be
implemented on any machine.
2) The sizes of the primitive data types are always
the same
 Application runs on all platforms.
9RAJESHREE KHANDE
Cont…
JAVA COMPILER
JAVA BYTE CODE
JAVA INTERPRETER
Windows 95 Macintosh Solaris Windows NT
(translator)
(same for all platforms)
(one for each different system)
10RAJESHREE KHANDE
Java Development Environment
Java Compiler
(Pentium)
Java Compiler
(PowerPC)
Java Compiler
(SPARC)
Java
Interpreter
Pentium
PowerPC
SPARC
Java
Interpreter
Java
Interpreter
Java
Code
Java
ByteCode
(Independent on
Platform)
javac Hello.java
Hello.class created
java Hello
Byte CodeRun JVM 11RAJESHREE KHANDE
JVM : Java Virtual Machine
 CPU are capable of executing only the machine
instruction.
 Different type of CPU hava different set of machine
instruction.
 To enable java program to be executed on different
CPUs without modification, Java program are
complied into machine instruction that can be
understood and executed by idealized CPU.
12RAJESHREE KHANDE
JVM : Java Virtual Machine (Cont..)
 Such CPU is called as Java virtual Machine (JVM)
 Actually JVM is simulated program which is
executed on actual CPU.
13RAJESHREE KHANDE
Cont…
 Compiled and Interpreted
 Java compiler generate byte-codes, not native
machine code.
 The compiled byte-codes are platform-
independent.
 Java bytecodes are translated to machine
readable instructions at runtime (Java Virtual
Machine)
14RAJESHREE KHANDE
Compiled Languages: C Execution
Text Editor Compiler linker
Programmer
Source Code
.c file
Object
Code
.o file
Notepad,
emacs,vi
gcc
Executable
Code
a.out file
15RAJESHREE KHANDE
Compiled Languages: Java Execution
Text Editor Compiler Interpreter
Programmer
Source Code
.java file
Byte Code
.class file
Hardware and
Operating System
Notepad, vi javac java
appletviewer
netscape
16RAJESHREE KHANDE
Cont..
 Java Compiler - Java source code (file with
extension .java) to bytecode (file with
extension .class)
 Bytecode - an intermediate form, closer to
machine representation
 A interpreter (virtual machine) on any target
platform interprets the bytecode.
17RAJESHREE KHANDE
Cont..
 Porting the java system to any new platform
involves writing an interpreter.
 The interpreter will figure out what the
equivalent machine dependent code to run.
18RAJESHREE KHANDE
Cont…
 Robust and Secure
 Usage in networked environments requires more
security
 Provides many safeguard to ensure reliable code.
 Strict compile time & run time type checking.
 Memory allocation model is a major defense
 Access restrictions are forced (private, public)
19RAJESHREE KHANDE
Cont…
 Distributed
 Designed as distributed lang. For creating
application on network.
 Java program can access remote access remote
objects on internet
20RAJESHREE KHANDE
Cont…
 Multithreaded
 Handles multiple task simultaneously.
 Java tools support multiprocessing
synchronization.
21RAJESHREE KHANDE
How Does Java Compares to C++
and Other OO Languages
C
C++
Java
22RAJESHREE KHANDE
Java better than C ?
 No Preprocessor
 No Global Variables
 No data types struct, union and enum
 No Goto ,size of and typedef
 No type modifier keywords auto, extern, register,
signed and unsigned.
 No Pointers
 Add labeled break and continue
23RAJESHREE KHANDE
Rich Class Environment
 Core Classes
 Language support Package :
Collection of classes For Implementing Basic
features of Java (java.lang.*)
 Utilities Package :
provide utility function such as date & time
(java.util.*)
 Input/Output package:
Collection of class required for input/output (java.io.*)
24RAJESHREE KHANDE
Rich Class Environment
 Networking package:
Collection of classes communication with other
computers via internet. (java.net.*)
 Abstract Window Tool Kit (AWT) :
Collection of Packages that implement platform
independent GUI (java.awt.*)
 Applet Package :
Set of classes allows to create applet program
(java.applet.*)
25RAJESHREE KHANDE
Java Applications
 We can develop two types of Java programs:
 Stand-alone applications
 Web applications (applets)
26RAJESHREE KHANDE
Applications v/s Applets
 Different ways to run a Java executable are:
Application-
A stand-alone program that can be invoked from
command line . A program that has a “main”
method
Applet-
A program embedded in a web page , to be run
when the page is browsed . A program that
contains no “main” method
27RAJESHREE KHANDE
Applets v/s Applications
 Different ways to run a Java executable are
Application –Executed by the Java interpreter.
Applet- Java enabled web browser.
28RAJESHREE KHANDE
Significance of downloading
Applets
 Interactive WWW
 Flashy animation instead of static web pages
 Applets react to users input and dynamically change
 Display of dynamic data
 WWW with Java - more than a document publishing
medium
 http://www.javasoft.com/applets/alpha/applets/Stock
Demo/standalone.html
29RAJESHREE KHANDE
Java Development Kit
Tools in JDK Purpose
javac It is java complier. It complies java source code into the
bytecode which can be understood by JVM.
java Java Interpreter – It interprets the bytecode into machine
code & then executes it
jdb Java debugger – detect the errors in java program
appletviewer Executes the special type of java program known as
applet
javadoc Used to create documentation in HTML
javah Produces a c header file for use with special type of java
method , known as native methods
Javap Java disassembler – Helps to convert bytecode file into
java program description
30RAJESHREE KHANDE
Process of Building and Running
Java Programs
Text Editor
Java Source
Code
javac
Java Class File
java
Outout
javadoc
javah
jdb
HTML Files
Header Files
31RAJESHREE KHANDE
Let us Try Out
Building your first Java Program
32RAJESHREE KHANDE
Creating, Compiling, and
Running Programs
Source Code
Create/Modify Source Code
Compile Source Code
i.e., javac Welcome.java
Bytecode
Run Byteode
i.e., java Welcome
Result
If compilation errors
If runtime errors or incorrect result
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
…
Method Welcome()
0 aload_0
…
Method void main(java.lang.String[])
0 getstatic #2 …
3 ldc #3 <String "Welcome to
Java!">
5 invokevirtual #4 …
8 return
Saved on the disk
stored on the disk
Source code (developed by the programmer)
Byte code (generated by the compiler for JVM
to read and interpret, not for you to understand)
33RAJESHREE KHANDE
Demo program
// HelloWorld.java
class HelloWorld
{
public static void main(String args[])
{
System.out.println(“Hello World”);
}
}
34RAJESHREE KHANDE
Program Processing
 Compilation
# javac hello.java
results is HelloInternet.class
 Execution
# java HelloInternet
Hello Internet
#
35RAJESHREE KHANDE
public static void main
Access to all / can be accessed from
everywhere
Does not return
anything
main Method
Means the main
method is shared by all
objects in the class.
Access without object
name
36RAJESHREE KHANDE
System.out.println(“…”);
Out is the output stream
used to connect the
console
To print the
specific string onto
output device in
next line.
System is predefined class
to provide access to the
system
System: System refers to current java program.
Out : out refers to output device. by default it is monitor.
println : to print the specific string onto output device in
next line
OR
37RAJESHREE KHANDE
Program Processing
 Compilation
C:> javac HelloWorld.java
results in HelloWorld.class
 Execution
c:> java HelloWorld
Hello World
38RAJESHREE KHANDE
Fundamental structure Java prog
/* a comment */
// a comment
[package declarations]
[import statements]
class declaration
{
}
An example is given below:
import java.lang.*;
class Demo
{
public static void main(String[] args)
{
Sytem.out.println("Hello! World");
}
39RAJESHREE KHANDE
Simple Java Applet
//HelloWorld.java
import java.applet.Applet;
import java.awt.*;
public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString (“Hello World !”,25,
25);
}
}
40RAJESHREE KHANDE
Calling an Applet
<HTML>
<TITLE>
HELLO WORLD APPLET
</TITLE>
<HEAD>
THE HELLO WORLD APPLET
</HEAD>
<APPLET CODE=“HelloWorld.class” width=500
height=500>
</APPLET>
</HTML> 41RAJESHREE KHANDE
Applet Execution
Using AppletViewer
Using Browser
42RAJESHREE KHANDE
Class & Object
 What Are Classes?
A class is a blueprint or prototype that
defines the variables and the methods
common to all objects of a certain kind.
 What Is an Object?
An object is a software bundle of variables
and related methods. Software objects are
often used to model real-world objects you
find in everyday life
43RAJESHREE KHANDE
Class vs. Object
 Specifies the
structure (the
number and types)
of its objects’
attributes — the
same for all of its
objects
 Specifies the
possible behaviors
of its objects
 Holds specific
values of attributes;
these values can
change while the
program is running
 Behaves
appropriately when
called upon
44RAJESHREE KHANDE
Class vs. Object
 A piece of the
program’s source
code
 Written by a
programmer
 An entity in a
running program
 Created when the
program is running
(by the main method
or a constructor or
another method)
45RAJESHREE KHANDE
Classes
public class Car
{
...
}
Car.java By convention, the
name of a class (and
its source file) always
starts with a capital
letter.
(In Java, all names are case-sensitive.)
46RAJESHREE KHANDE
public class SomeClass
 Fields
 Constructors
 Methods
}
Attributes / variables that define the
object’s state; can hold numbers,
characters, strings, other objects
Procedures for constructing
a new object of this class
and initializing its fields
Actions that an object
of this class can take
(behaviors)
{
Class header
SomeClass.java
import ... import statements
47RAJESHREE KHANDE
Classes
 A class is a collection of fields (data) and methods
(procedure or function) that operate on that data.
 The basic syntax for a class definition:
 Bare bone class – no fields, no methods
public class Circle {
// my circle class
}
ClassName]
{
[fields declaration]
[methods declaration]
}
48RAJESHREE KHANDE
Classes
 Classes describe the data held by each of its
objects
 A class may describe any number of objects
 A class may describe a single object, or even
no objects at all
49RAJESHREE KHANDE

More Related Content

What's hot

Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programmingElizabeth Thomas
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaAjay Sharma
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology dM Technologies
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVAKUNAL GADHIA
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programmingbusiness Corporate
 
Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Sahil Gupta
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core javamahir jain
 
Core Java
Core JavaCore Java
Core JavaNA
 

What's hot (19)

Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 
History of java
History of javaHistory of java
History of java
 
Core java
Core javaCore java
Core java
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 
Java notes
Java notesJava notes
Java notes
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programming
 
Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Core java slides
Core java slidesCore java slides
Core java slides
 
Core Java
Core JavaCore Java
Core Java
 
Programming in java ppt
Programming in java  pptProgramming in java  ppt
Programming in java ppt
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Core Java
Core JavaCore Java
Core Java
 

Similar to Intoduction to java

Core Java Slides
Core Java SlidesCore Java Slides
Core Java SlidesVinit Vyas
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01Jay Palit
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docxvikasbagra9887
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxDrPreethiD1
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkMohit Belwal
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unitgowher172236
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with javaIntro C# Book
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
What is Java
What is JavaWhat is Java
What is Java3trg
 

Similar to Intoduction to java (20)

Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
 
Java presentation
Java presentationJava presentation
Java presentation
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
Java Intro
Java IntroJava Intro
Java Intro
 
JAVA First Day
JAVA First DayJAVA First Day
JAVA First Day
 
Java
JavaJava
Java
 
Java session2
Java session2Java session2
Java session2
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
 
01. Introduction to programming with java
01. Introduction to programming with java01. Introduction to programming with java
01. Introduction to programming with java
 
java basics.pptx
java basics.pptxjava basics.pptx
java basics.pptx
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
 
BlueJ Two
BlueJ TwoBlueJ Two
BlueJ Two
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
What is Java
What is JavaWhat is Java
What is Java
 

Recently uploaded

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 

Recently uploaded (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Intoduction to java

  • 1. Java Evolution  Java Introduction  Java Features  How Java Differs from other OO languages 1RAJESHREE KHANDE
  • 2. Java - An Introduction  Java - The new programming language developed by Sun Microsystems (James Gosling) in 1991.  Originally called Oak.  Java Authors: James Gosling, Arthur Van Hoff, Andy Bechtolsheim  A general-purpose object-oriented language.  Designed for easy Web/Internet applications 2RAJESHREE KHANDE
  • 3. Java - An Introduction  Originally created for consumer electronics (TV, VCR, Freeze, Washing Machine, Mobile Phone).  Java - CPU Independent language  Internet and Web was just emerging, so Sun turned it into a language of Internet Programming.  It allows you to publish a webpage with Java code in it. 3RAJESHREE KHANDE
  • 4. Year Development 1990 Sun decided to developed special software that could be used for electronic devices. A project called Green Project created and head by James Gosling. 1991 Explored possibility of using C++, with some updates announced a new language named “Oak” 1992 The team demonstrated the application of their new language to control a list of home appliances using a hand held device. 1993 The World Wide Web appeared on the Internet and transformed the text-based interface to a graphical rich environment. The team developed Web applets (time programs) that could run on all types of computers connected to the Internet. Java Milestones 4RAJESHREE KHANDE
  • 5. Java Milestones Year Development 1994 The team developed a new Web browsed called “Hot Java” to locate and run Applets. HotJava gained instance success. 1995 Oak was renamed to Java, as it did not survive “legal” registration. Many companies such as Netscape and Microsoft announced their support for Java 1996 Java established itself as both 1. “the language for Internet programming” 2. a general purpose OO language. 1997 A class libraries, Community effort and standardization, Enterprise Java, Clustering, etc.. 5RAJESHREE KHANDE
  • 6. Java Features  Familiar, Simple, Small  Object-Oriented  Platform-Independent and Portable  Compiled and Interpreted  Robust and Secure  Distributed  Multithreaded  High Performance  Dynamic and Extensible 6RAJESHREE KHANDE
  • 7. Cont…  Familiar, Simple & Small  Java does not use Preprocessor header files, goto statement and many others  no pointers  automatic garbage collection  rich pre-defined class library http://java.sun.com/j2se/1.4.2/docs/api/ 7RAJESHREE KHANDE
  • 8. Cont…  Object-Oriented  Focus on the data (objects) and methods manipulating the data  Almost every thing in Java is Object.  All functions are associated with objects  Almost all datatypes are objects (files, strings, etc.)  Potentially better code organization and reuse 8RAJESHREE KHANDE
  • 9. Cont…  Platform-Independent and Portable  Java is portable. 1) Java Complier generates bytecode that can be implemented on any machine. 2) The sizes of the primitive data types are always the same  Application runs on all platforms. 9RAJESHREE KHANDE
  • 10. Cont… JAVA COMPILER JAVA BYTE CODE JAVA INTERPRETER Windows 95 Macintosh Solaris Windows NT (translator) (same for all platforms) (one for each different system) 10RAJESHREE KHANDE
  • 11. Java Development Environment Java Compiler (Pentium) Java Compiler (PowerPC) Java Compiler (SPARC) Java Interpreter Pentium PowerPC SPARC Java Interpreter Java Interpreter Java Code Java ByteCode (Independent on Platform) javac Hello.java Hello.class created java Hello Byte CodeRun JVM 11RAJESHREE KHANDE
  • 12. JVM : Java Virtual Machine  CPU are capable of executing only the machine instruction.  Different type of CPU hava different set of machine instruction.  To enable java program to be executed on different CPUs without modification, Java program are complied into machine instruction that can be understood and executed by idealized CPU. 12RAJESHREE KHANDE
  • 13. JVM : Java Virtual Machine (Cont..)  Such CPU is called as Java virtual Machine (JVM)  Actually JVM is simulated program which is executed on actual CPU. 13RAJESHREE KHANDE
  • 14. Cont…  Compiled and Interpreted  Java compiler generate byte-codes, not native machine code.  The compiled byte-codes are platform- independent.  Java bytecodes are translated to machine readable instructions at runtime (Java Virtual Machine) 14RAJESHREE KHANDE
  • 15. Compiled Languages: C Execution Text Editor Compiler linker Programmer Source Code .c file Object Code .o file Notepad, emacs,vi gcc Executable Code a.out file 15RAJESHREE KHANDE
  • 16. Compiled Languages: Java Execution Text Editor Compiler Interpreter Programmer Source Code .java file Byte Code .class file Hardware and Operating System Notepad, vi javac java appletviewer netscape 16RAJESHREE KHANDE
  • 17. Cont..  Java Compiler - Java source code (file with extension .java) to bytecode (file with extension .class)  Bytecode - an intermediate form, closer to machine representation  A interpreter (virtual machine) on any target platform interprets the bytecode. 17RAJESHREE KHANDE
  • 18. Cont..  Porting the java system to any new platform involves writing an interpreter.  The interpreter will figure out what the equivalent machine dependent code to run. 18RAJESHREE KHANDE
  • 19. Cont…  Robust and Secure  Usage in networked environments requires more security  Provides many safeguard to ensure reliable code.  Strict compile time & run time type checking.  Memory allocation model is a major defense  Access restrictions are forced (private, public) 19RAJESHREE KHANDE
  • 20. Cont…  Distributed  Designed as distributed lang. For creating application on network.  Java program can access remote access remote objects on internet 20RAJESHREE KHANDE
  • 21. Cont…  Multithreaded  Handles multiple task simultaneously.  Java tools support multiprocessing synchronization. 21RAJESHREE KHANDE
  • 22. How Does Java Compares to C++ and Other OO Languages C C++ Java 22RAJESHREE KHANDE
  • 23. Java better than C ?  No Preprocessor  No Global Variables  No data types struct, union and enum  No Goto ,size of and typedef  No type modifier keywords auto, extern, register, signed and unsigned.  No Pointers  Add labeled break and continue 23RAJESHREE KHANDE
  • 24. Rich Class Environment  Core Classes  Language support Package : Collection of classes For Implementing Basic features of Java (java.lang.*)  Utilities Package : provide utility function such as date & time (java.util.*)  Input/Output package: Collection of class required for input/output (java.io.*) 24RAJESHREE KHANDE
  • 25. Rich Class Environment  Networking package: Collection of classes communication with other computers via internet. (java.net.*)  Abstract Window Tool Kit (AWT) : Collection of Packages that implement platform independent GUI (java.awt.*)  Applet Package : Set of classes allows to create applet program (java.applet.*) 25RAJESHREE KHANDE
  • 26. Java Applications  We can develop two types of Java programs:  Stand-alone applications  Web applications (applets) 26RAJESHREE KHANDE
  • 27. Applications v/s Applets  Different ways to run a Java executable are: Application- A stand-alone program that can be invoked from command line . A program that has a “main” method Applet- A program embedded in a web page , to be run when the page is browsed . A program that contains no “main” method 27RAJESHREE KHANDE
  • 28. Applets v/s Applications  Different ways to run a Java executable are Application –Executed by the Java interpreter. Applet- Java enabled web browser. 28RAJESHREE KHANDE
  • 29. Significance of downloading Applets  Interactive WWW  Flashy animation instead of static web pages  Applets react to users input and dynamically change  Display of dynamic data  WWW with Java - more than a document publishing medium  http://www.javasoft.com/applets/alpha/applets/Stock Demo/standalone.html 29RAJESHREE KHANDE
  • 30. Java Development Kit Tools in JDK Purpose javac It is java complier. It complies java source code into the bytecode which can be understood by JVM. java Java Interpreter – It interprets the bytecode into machine code & then executes it jdb Java debugger – detect the errors in java program appletviewer Executes the special type of java program known as applet javadoc Used to create documentation in HTML javah Produces a c header file for use with special type of java method , known as native methods Javap Java disassembler – Helps to convert bytecode file into java program description 30RAJESHREE KHANDE
  • 31. Process of Building and Running Java Programs Text Editor Java Source Code javac Java Class File java Outout javadoc javah jdb HTML Files Header Files 31RAJESHREE KHANDE
  • 32. Let us Try Out Building your first Java Program 32RAJESHREE KHANDE
  • 33. Creating, Compiling, and Running Programs Source Code Create/Modify Source Code Compile Source Code i.e., javac Welcome.java Bytecode Run Byteode i.e., java Welcome Result If compilation errors If runtime errors or incorrect result public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } … Method Welcome() 0 aload_0 … Method void main(java.lang.String[]) 0 getstatic #2 … 3 ldc #3 <String "Welcome to Java!"> 5 invokevirtual #4 … 8 return Saved on the disk stored on the disk Source code (developed by the programmer) Byte code (generated by the compiler for JVM to read and interpret, not for you to understand) 33RAJESHREE KHANDE
  • 34. Demo program // HelloWorld.java class HelloWorld { public static void main(String args[]) { System.out.println(“Hello World”); } } 34RAJESHREE KHANDE
  • 35. Program Processing  Compilation # javac hello.java results is HelloInternet.class  Execution # java HelloInternet Hello Internet # 35RAJESHREE KHANDE
  • 36. public static void main Access to all / can be accessed from everywhere Does not return anything main Method Means the main method is shared by all objects in the class. Access without object name 36RAJESHREE KHANDE
  • 37. System.out.println(“…”); Out is the output stream used to connect the console To print the specific string onto output device in next line. System is predefined class to provide access to the system System: System refers to current java program. Out : out refers to output device. by default it is monitor. println : to print the specific string onto output device in next line OR 37RAJESHREE KHANDE
  • 38. Program Processing  Compilation C:> javac HelloWorld.java results in HelloWorld.class  Execution c:> java HelloWorld Hello World 38RAJESHREE KHANDE
  • 39. Fundamental structure Java prog /* a comment */ // a comment [package declarations] [import statements] class declaration { } An example is given below: import java.lang.*; class Demo { public static void main(String[] args) { Sytem.out.println("Hello! World"); } 39RAJESHREE KHANDE
  • 40. Simple Java Applet //HelloWorld.java import java.applet.Applet; import java.awt.*; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString (“Hello World !”,25, 25); } } 40RAJESHREE KHANDE
  • 41. Calling an Applet <HTML> <TITLE> HELLO WORLD APPLET </TITLE> <HEAD> THE HELLO WORLD APPLET </HEAD> <APPLET CODE=“HelloWorld.class” width=500 height=500> </APPLET> </HTML> 41RAJESHREE KHANDE
  • 42. Applet Execution Using AppletViewer Using Browser 42RAJESHREE KHANDE
  • 43. Class & Object  What Are Classes? A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.  What Is an Object? An object is a software bundle of variables and related methods. Software objects are often used to model real-world objects you find in everyday life 43RAJESHREE KHANDE
  • 44. Class vs. Object  Specifies the structure (the number and types) of its objects’ attributes — the same for all of its objects  Specifies the possible behaviors of its objects  Holds specific values of attributes; these values can change while the program is running  Behaves appropriately when called upon 44RAJESHREE KHANDE
  • 45. Class vs. Object  A piece of the program’s source code  Written by a programmer  An entity in a running program  Created when the program is running (by the main method or a constructor or another method) 45RAJESHREE KHANDE
  • 46. Classes public class Car { ... } Car.java By convention, the name of a class (and its source file) always starts with a capital letter. (In Java, all names are case-sensitive.) 46RAJESHREE KHANDE
  • 47. public class SomeClass  Fields  Constructors  Methods } Attributes / variables that define the object’s state; can hold numbers, characters, strings, other objects Procedures for constructing a new object of this class and initializing its fields Actions that an object of this class can take (behaviors) { Class header SomeClass.java import ... import statements 47RAJESHREE KHANDE
  • 48. Classes  A class is a collection of fields (data) and methods (procedure or function) that operate on that data.  The basic syntax for a class definition:  Bare bone class – no fields, no methods public class Circle { // my circle class } ClassName] { [fields declaration] [methods declaration] } 48RAJESHREE KHANDE
  • 49. Classes  Classes describe the data held by each of its objects  A class may describe any number of objects  A class may describe a single object, or even no objects at all 49RAJESHREE KHANDE