Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
INTRODUCTION ON JAVA PROGRAMMING
MS. K.NANTHINI
ASSISTANT PROFESSOR,
KONGU ENGINEERING COLLEGE,
ERODE, TAMILNADU,
Overview
-Programming language and computing platform
-first released by Sun Microsystems in 1995
-Java is a simple, general-purpose, object-oriented, robust, secure, architecture-neutral,
portable, high-performance, multithreaded computer language
-JDK
-JRE
-JVM
write once, run anywhere" (WORA)
History
-James Gosling from Sun Microsystems and his team began designing the first version of Java
aimed at programming home appliances
-Name:Oak-Green-Java
Java Platform
A platform is the hardware or software environment in
which a program runs.
Popular Platforms : Microsoft Windows, Linux, Solaris OS,
and Mac OS - combination of the operating system and
underlying hardware
But Java is software-only platform that runs on top of other
hardware-based platforms
-Components
(Cont.,)
Java Architecture
Components of Java Architecture
Java Virtual Machine:
The JVM is a Java platform component that provides an environment for executing Java
programs. JVM interprets the byte code into machine code which is executed in the machine in
which the Java program runs.
Java Runtime Environment:
The JRE software builds a runtime environment in which Java programs can be executed. The JRE
is the on-disk system that takes your Java code, combines it with the needed libraries, and starts
the JVM to execute it. The JRE contains libraries and software needed by your Java programs to
run
Java Development Kit:
The Java Development Kit (JDK) is a software development environment used to develop Java
applications and applets
JVM Architecture
(Cont.,)
Class Loader: Class loader is a subsystem of JVM. It is used to load class files. Whenever we run
the java program, class loader loads it first.
Class method area: It is one of the Data Area in JVM, in which Class data will be stored. Static
Variables, Static Blocks, Static Methods, Instance Methods are stored in this area.
Heap: A heap is created when the JVM starts up. It may increase or decrease in size while the
application runs.
Stack: JVM stack is known as a thread stack. It is a data area in the JVM memory which is
created for a single execution thread. The JVM stack of a thread is used by the thread to store
various elements i.e.; local variables, partial results, and data for calling method and returns.
(Cont.,)
Native stack: It subsumes all the native methods used in your application.
Execution Engine:
JIT compiler
Garbage collector
JIT compiler: The Just in Time is a part of the runtime environment. It helps in improving the
performance of Java applications by compiling bytecodes to machine code at run time. The JIT
compiler is enabled by default. When a method is compiled, the JVM calls the compiled code of that
method directly. The JIT compiler compiles the bytecode of that method into machine code,
compiling it “just in time” to run.
Garbage collector: As the name explains that Garbage Collector means to collect the unused
material. Well, in JVM this work is done by Garbage collection. It tracks each and every object
available in the JVM heap space and removes unwanted ones.
Types of Java Applications
-Application Programs
-Applet Programs
Features
- Simple, Object Oriented, and Familiar
- Robust and Secure
- Architecture Neutral and Portable
- High Performance
- Interpreted, Threaded, and Dynamic
Drawbacks
- Slow performance
- Automatic memory management
- Different JVM for different platform
- No support for low-level programming
- Poor features in GUI
Setting Java
- Download the latest version of JDK (Java Development Kit) on your machine
- set environment variable to point to correct installation directory
- An Environment variable is an object on a computer that stores a value(key-value pair), which
can be referenced by one or more software programs in Windows
- Path and Class Path :
PATH is an environment variable which is used to locate JDK binaries like "java" or "javac"
command used to run java program and compile java source file.
CLASSPATH environment variable is used by System or Application ClassLoader to locate and
load compile Java bytecodes stored in .class file
Check- Java installed or not
Stucture of Java Program
Documentation Section
Package Statement
Import Statements
Interface Statement
Class Definition
Main Method Class
Main Method Definition
Sample
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello Java");
}
}
Points to remember
You have to keep in mind that,
Java code is case sensitive
To write a Java program, you must have to define class first
The name of the class in Java (which holds the main method) is the name of the Java program,
and the same name will be given in the filename
Program Explanation
public class Hello The public word means that it is accessible from any other classes.
/* Comments */ The compiler ignores comment block.
Braces Two curly brackets {...} are used to group all the commands, so it is known that the commands
belong to that class or method.
public static void main •When the main method is declared public, it means that it can also be used by code outside
of its class, due to which the main method is declared public.
•The word static used when we want to access a method without creating its object, as we
call the main method, before creating any class objects.
•main is a method; this is a starting point of a Java program.
String[] args It is an array where each element of it is a string, which has been named as "args". If your Java
program is run through the console, you can pass the input parameter, and main() method
takes it as input.
System.out.println(); This statement is used to print text on the screen as output. All Java statement ends with a
semicolon.
Java Data Types
Tells the compiler what type of variable it as and what type of data it is going to store.
- Data type specifies the size and type of values.
Primary Data Type
Java supports eight primitive data types: byte, short, int, long, float, double, char and boolean.
These eight data types are classified into four groups:
◦ Integer,
◦ Relational Numbers(Floating point)
◦ Characters
◦ Boolean(Conditional).
Non-Primitive Data Types
Classes,Interface, Arrays etc.
(Cont.,)
Type Contains Default Size Range
byte Signed integer 0 8 bit or
1 byte
-27 to 27-1 or
-128 to 127
short Signed integer 0 16 bit or
2 bytes
-215 to 215-1 or
-32,768 to 32767
int Signed integer 0 32 bit or
4 bytes
-231 to 231-1 or
-2147,483,648 to
2147,483,647
long Signed integer 0 64 bit or
8 bytes
-263 to 263-1 or
-
9223,372,036,854,755,8
08 to
9223,372,036,854,755,8
07
(Cont.,)
Type Contains Default Size Range
float IEEE 754 floating
point
single-precision
0.0f 32 bit or
4 bytes
±1.4E-45 to
±3.40282347E+38
F
double IEEE 754 floating
point
double-precision
0.0 64 bit or
8 bytes
±439E-324 to
±1.797693134862
3157E+308
(Contd.,)
Type Contains Default Size Range
char Unicode character
unsigned
u0000 16 bits or
2 bytes
0 to 216-1 or
u0000 to uFFFF
Type Contains Default Size Range
boolean true or false false 1 bit true or false
Java Variables
1. Declaration - eg. int width, height=5;
2. Initialization - static and dynamic initialization
3. Rules of Declaring variables
4. Scope of Variables - limit, as far as the variable can be used
5. Local variables - A variable that is declared within the method
6. Instance variables - A non-static variable that is declared within the class
7. Class/Static variables - A variable that is declared with static keyword in a class
Introduction java programming

More Related Content

What's hot

Object oriented programming using c++
Object oriented programming using c++Object oriented programming using c++
Object oriented programming using c++
Hoang Nguyen
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
Haitham El-Ghareeb
 
Java Collections
Java  Collections Java  Collections
Io streams
Io streamsIo streams
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
Berk Soysal
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
Harsh Patel
 
Collection framework
Collection frameworkCollection framework
Collection framework
Ravi_Kant_Sahu
 
Chapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part IIChapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part II
Eduardo Bergavera
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
GauravPatil318
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
Atif Khan
 
Machine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable ConversionMachine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable Conversion
Andrew Ferlitsch
 
C++ training
C++ training C++ training
C++ training
PL Sharma
 
Lecture-05-DSA
Lecture-05-DSALecture-05-DSA
Lecture-05-DSA
Haitham El-Ghareeb
 
A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++
M Hussnain Ali
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
lykado0dles
 
Classes,object and methods java
Classes,object and methods javaClasses,object and methods java
Classes,object and methods java
Padma Kannan
 
Standard template library
Standard template libraryStandard template library
Standard template library
Sukriti Singh
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
Berk Soysal
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
Kumar Gaurav
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
jehan1987
 

What's hot (20)

Object oriented programming using c++
Object oriented programming using c++Object oriented programming using c++
Object oriented programming using c++
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Io streams
Io streamsIo streams
Io streams
 
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Chapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part IIChapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part II
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
 
Machine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable ConversionMachine Learning - Dummy Variable Conversion
Machine Learning - Dummy Variable Conversion
 
C++ training
C++ training C++ training
C++ training
 
Lecture-05-DSA
Lecture-05-DSALecture-05-DSA
Lecture-05-DSA
 
A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++A COMPLETE FILE FOR C++
A COMPLETE FILE FOR C++
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
Classes,object and methods java
Classes,object and methods javaClasses,object and methods java
Classes,object and methods java
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 

Similar to Introduction java programming

Java programming basics
Java programming basicsJava programming basics
Java programming basics
Hamid Ghorbani
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
EduclentMegasoftel
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
Madhura Bhalerao
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
buvanabala
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
Umesh Kumar
 
Java1
Java1Java1
Java
Java Java
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
NaorinHalim
 
Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction
AKR Education
 
Core java &collections
Core java &collectionsCore java &collections
Core java &collections
Ravi varma
 
Core java1
Core java1Core java1
Core java1
Ravi varma
 
Core java
Core java Core java
Core java
Ravi varma
 
CORE JAVA
CORE JAVACORE JAVA
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
KCC Software Ltd. & Easylearning.guru
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
Seo Gyansha
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
Manuel Fomitescu
 
Basic Java I
Basic Java IBasic Java I
java slides
java slidesjava slides
java slides
RizwanTariq18
 
Java introduction
Java introductionJava introduction
Java introduction
The icfai university jaipur
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
Nithin Kumar,VVCE, Mysuru
 

Similar to Introduction java programming (20)

Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction
 
Core java &collections
Core java &collectionsCore java &collections
Core java &collections
 
Core java1
Core java1Core java1
Core java1
 
Core java
Core java Core java
Core java
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Java essentials for hadoop
Java essentials for hadoopJava essentials for hadoop
Java essentials for hadoop
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
 
Basic Java I
Basic Java IBasic Java I
Basic Java I
 
java slides
java slidesjava slides
java slides
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 

Recently uploaded

Analysis and Design of Algorithm Lab Manual (BCSL404)
Analysis and Design of Algorithm Lab Manual (BCSL404)Analysis and Design of Algorithm Lab Manual (BCSL404)
Analysis and Design of Algorithm Lab Manual (BCSL404)
VishalMore197390
 
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
Escorts service
 
Germany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptxGermany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptx
rebecca841358
 
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model SafeBangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
bookhotbebes1
 
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE DonatoCONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
Servizi a rete
 
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdfOCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
Muanisa Waras
 
Introduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer NetworkingIntroduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer Networking
Md.Shohel Rana ( M.Sc in CSE Khulna University of Engineering & Technology (KUET))
 
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
hahehot
 
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
sanabts249
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
RujanTimsina1
 
Literature Reivew of Student Center Design
Literature Reivew of Student Center DesignLiterature Reivew of Student Center Design
Literature Reivew of Student Center Design
PriyankaKarn3
 
Quadcopter Dynamics, Stability and Control
Quadcopter Dynamics, Stability and ControlQuadcopter Dynamics, Stability and Control
Quadcopter Dynamics, Stability and Control
Blesson Easo Varghese
 
Introduction to neural network (Module 1).pptx
Introduction to neural network (Module 1).pptxIntroduction to neural network (Module 1).pptx
Introduction to neural network (Module 1).pptx
archanac21
 
Press Tool and It's Primary Components.pdf
Press Tool and It's Primary Components.pdfPress Tool and It's Primary Components.pdf
Press Tool and It's Primary Components.pdf
Tool and Die Tech
 
Biology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtuBiology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtu
santoshpatilrao33
 
Application Infrastructure and cloud computing.pdf
Application Infrastructure and cloud computing.pdfApplication Infrastructure and cloud computing.pdf
Application Infrastructure and cloud computing.pdf
Mithun Chakroborty
 
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
VICTOR MAESTRE RAMIREZ
 
Software Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project ManagementSoftware Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project Management
Prakhyath Rai
 
( Call  ) Girls Noida 9873940964 High Profile
( Call  ) Girls Noida 9873940964 High Profile( Call  ) Girls Noida 9873940964 High Profile
( Call  ) Girls Noida 9873940964 High Profile
butwhat24
 
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdfGUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
ProexportColombia1
 

Recently uploaded (20)

Analysis and Design of Algorithm Lab Manual (BCSL404)
Analysis and Design of Algorithm Lab Manual (BCSL404)Analysis and Design of Algorithm Lab Manual (BCSL404)
Analysis and Design of Algorithm Lab Manual (BCSL404)
 
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
@Call @Girls Kochi 🚒 XXXXXXXXXX 🚒 Priya Sharma Beautiful And Cute Girl any Time
 
Germany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptxGermany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptx
 
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model SafeBangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Bangalore @ℂall @Girls ꧁❤ 0000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
 
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE DonatoCONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
 
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdfOCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
 
Introduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer NetworkingIntroduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer Networking
 
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
一比一原版(skku毕业证)韩国成均馆大学毕业证如何办理
 
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
21CV61- Module 3 (CONSTRUCTION MANAGEMENT AND ENTREPRENEURSHIP.pptx
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
 
Literature Reivew of Student Center Design
Literature Reivew of Student Center DesignLiterature Reivew of Student Center Design
Literature Reivew of Student Center Design
 
Quadcopter Dynamics, Stability and Control
Quadcopter Dynamics, Stability and ControlQuadcopter Dynamics, Stability and Control
Quadcopter Dynamics, Stability and Control
 
Introduction to neural network (Module 1).pptx
Introduction to neural network (Module 1).pptxIntroduction to neural network (Module 1).pptx
Introduction to neural network (Module 1).pptx
 
Press Tool and It's Primary Components.pdf
Press Tool and It's Primary Components.pdfPress Tool and It's Primary Components.pdf
Press Tool and It's Primary Components.pdf
 
Biology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtuBiology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtu
 
Application Infrastructure and cloud computing.pdf
Application Infrastructure and cloud computing.pdfApplication Infrastructure and cloud computing.pdf
Application Infrastructure and cloud computing.pdf
 
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
Advances in Detect and Avoid for Unmanned Aircraft Systems and Advanced Air M...
 
Software Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project ManagementSoftware Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project Management
 
( Call  ) Girls Noida 9873940964 High Profile
( Call  ) Girls Noida 9873940964 High Profile( Call  ) Girls Noida 9873940964 High Profile
( Call  ) Girls Noida 9873940964 High Profile
 
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdfGUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
 

Introduction java programming

  • 1. INTRODUCTION ON JAVA PROGRAMMING MS. K.NANTHINI ASSISTANT PROFESSOR, KONGU ENGINEERING COLLEGE, ERODE, TAMILNADU,
  • 2. Overview -Programming language and computing platform -first released by Sun Microsystems in 1995 -Java is a simple, general-purpose, object-oriented, robust, secure, architecture-neutral, portable, high-performance, multithreaded computer language -JDK -JRE -JVM write once, run anywhere" (WORA)
  • 3. History -James Gosling from Sun Microsystems and his team began designing the first version of Java aimed at programming home appliances -Name:Oak-Green-Java
  • 4. Java Platform A platform is the hardware or software environment in which a program runs. Popular Platforms : Microsoft Windows, Linux, Solaris OS, and Mac OS - combination of the operating system and underlying hardware But Java is software-only platform that runs on top of other hardware-based platforms -Components
  • 7. Components of Java Architecture Java Virtual Machine: The JVM is a Java platform component that provides an environment for executing Java programs. JVM interprets the byte code into machine code which is executed in the machine in which the Java program runs. Java Runtime Environment: The JRE software builds a runtime environment in which Java programs can be executed. The JRE is the on-disk system that takes your Java code, combines it with the needed libraries, and starts the JVM to execute it. The JRE contains libraries and software needed by your Java programs to run Java Development Kit: The Java Development Kit (JDK) is a software development environment used to develop Java applications and applets
  • 9. (Cont.,) Class Loader: Class loader is a subsystem of JVM. It is used to load class files. Whenever we run the java program, class loader loads it first. Class method area: It is one of the Data Area in JVM, in which Class data will be stored. Static Variables, Static Blocks, Static Methods, Instance Methods are stored in this area. Heap: A heap is created when the JVM starts up. It may increase or decrease in size while the application runs. Stack: JVM stack is known as a thread stack. It is a data area in the JVM memory which is created for a single execution thread. The JVM stack of a thread is used by the thread to store various elements i.e.; local variables, partial results, and data for calling method and returns.
  • 10. (Cont.,) Native stack: It subsumes all the native methods used in your application. Execution Engine: JIT compiler Garbage collector JIT compiler: The Just in Time is a part of the runtime environment. It helps in improving the performance of Java applications by compiling bytecodes to machine code at run time. The JIT compiler is enabled by default. When a method is compiled, the JVM calls the compiled code of that method directly. The JIT compiler compiles the bytecode of that method into machine code, compiling it “just in time” to run. Garbage collector: As the name explains that Garbage Collector means to collect the unused material. Well, in JVM this work is done by Garbage collection. It tracks each and every object available in the JVM heap space and removes unwanted ones.
  • 11. Types of Java Applications -Application Programs -Applet Programs
  • 12. Features - Simple, Object Oriented, and Familiar - Robust and Secure - Architecture Neutral and Portable - High Performance - Interpreted, Threaded, and Dynamic
  • 13. Drawbacks - Slow performance - Automatic memory management - Different JVM for different platform - No support for low-level programming - Poor features in GUI
  • 14. Setting Java - Download the latest version of JDK (Java Development Kit) on your machine - set environment variable to point to correct installation directory - An Environment variable is an object on a computer that stores a value(key-value pair), which can be referenced by one or more software programs in Windows - Path and Class Path : PATH is an environment variable which is used to locate JDK binaries like "java" or "javac" command used to run java program and compile java source file. CLASSPATH environment variable is used by System or Application ClassLoader to locate and load compile Java bytecodes stored in .class file
  • 16. Stucture of Java Program Documentation Section Package Statement Import Statements Interface Statement Class Definition Main Method Class Main Method Definition
  • 17. Sample public class Hello { public static void main(String[] args) { System.out.println("Hello Java"); } }
  • 18. Points to remember You have to keep in mind that, Java code is case sensitive To write a Java program, you must have to define class first The name of the class in Java (which holds the main method) is the name of the Java program, and the same name will be given in the filename
  • 19. Program Explanation public class Hello The public word means that it is accessible from any other classes. /* Comments */ The compiler ignores comment block. Braces Two curly brackets {...} are used to group all the commands, so it is known that the commands belong to that class or method. public static void main •When the main method is declared public, it means that it can also be used by code outside of its class, due to which the main method is declared public. •The word static used when we want to access a method without creating its object, as we call the main method, before creating any class objects. •main is a method; this is a starting point of a Java program. String[] args It is an array where each element of it is a string, which has been named as "args". If your Java program is run through the console, you can pass the input parameter, and main() method takes it as input. System.out.println(); This statement is used to print text on the screen as output. All Java statement ends with a semicolon.
  • 20. Java Data Types Tells the compiler what type of variable it as and what type of data it is going to store. - Data type specifies the size and type of values. Primary Data Type Java supports eight primitive data types: byte, short, int, long, float, double, char and boolean. These eight data types are classified into four groups: ◦ Integer, ◦ Relational Numbers(Floating point) ◦ Characters ◦ Boolean(Conditional). Non-Primitive Data Types Classes,Interface, Arrays etc.
  • 21. (Cont.,) Type Contains Default Size Range byte Signed integer 0 8 bit or 1 byte -27 to 27-1 or -128 to 127 short Signed integer 0 16 bit or 2 bytes -215 to 215-1 or -32,768 to 32767 int Signed integer 0 32 bit or 4 bytes -231 to 231-1 or -2147,483,648 to 2147,483,647 long Signed integer 0 64 bit or 8 bytes -263 to 263-1 or - 9223,372,036,854,755,8 08 to 9223,372,036,854,755,8 07
  • 22. (Cont.,) Type Contains Default Size Range float IEEE 754 floating point single-precision 0.0f 32 bit or 4 bytes ±1.4E-45 to ±3.40282347E+38 F double IEEE 754 floating point double-precision 0.0 64 bit or 8 bytes ±439E-324 to ±1.797693134862 3157E+308
  • 23. (Contd.,) Type Contains Default Size Range char Unicode character unsigned u0000 16 bits or 2 bytes 0 to 216-1 or u0000 to uFFFF Type Contains Default Size Range boolean true or false false 1 bit true or false
  • 24. Java Variables 1. Declaration - eg. int width, height=5; 2. Initialization - static and dynamic initialization 3. Rules of Declaring variables 4. Scope of Variables - limit, as far as the variable can be used 5. Local variables - A variable that is declared within the method 6. Instance variables - A non-static variable that is declared within the class 7. Class/Static variables - A variable that is declared with static keyword in a class