SlideShare ist ein Scribd-Unternehmen logo
1 von 25
    Module 1   Getting Started
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Definition •  A high-level programming language  •  O riginally called  OAK . •  In 1995 name  changed  to Java and  also  modified to take advantage of World Wide Web.
How Java works •  A program is both compiled and interpreted.  •  With the compiler, first you translate a program  into an intermediate language called  Java  bytecodes   •  This  platform-independent code is interpreted by the  interpreter   •   The interpreter parses and runs each Java bytecode  •   Compilation happens just once •   Interpretation occurs each time the program is executed.
 
Key Features of Java Programming Language   1. Platform Independence   Java compilers do not produce native object code  for a particular platform but rather ‘byte code’ instructions  for the Java Virtual Machine (JVM). 2. Object Orientation   Java is a pure object-oriented language. This means  that everything in a Java program is an object and  everything is descended from a root object class.
3. Rich Standard Library   The Java environment includes hundreds of classes  and methods in six major functional areas.  1. Language Support    2.  Utility 3. Input/output  4.  Networking 5. Abstract Window Toolkit  6.  Applet 4. Familiar C++ like Syntax 5 .  Garbage Collection  - Java does not require programmers to  explicitly free dynamically allocated memory. This makes  Java programs easier to write and less prone to memory  errors.
[object Object],[object Object],[object Object]
 
 
 
Java Virtual Machine Functionality •  Provides hardware platform specifications •  Reads compiled byte codes that are platform  independent  •  The Java interpreter installed on your computer  implements the Java VM.
Java Platform
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Consider MyClass myRef = new MyClass(); this creates an object somewhere in the heap, it also creates a  reference variable called 'myRef' that effectively points to the spot  in the heap where the object is. Consider the right side indicates the heap and left side is list of  references,  draw an arrow to show where each ref is pointing to. MyClass ref2 = myRef; We have two things on the left, each with an arrow pointing to  the single object on the right.
Go through the code line by line, drawing and erasing arrows as  Needed, you can then see when an object has no arrows pointing to it,  thus making it eligible for garbage collection.  Ways to call garbage collector algorithms In reality, it is possible only to suggest to the JVM that it perform  garbage collection. However, there are no guarantees the JVM will  actually remove all of the unused objects from memory. The garbage collection routines that Java provides are members of the  Runtime class.  The Runtime class is a special class that has a single object (a Singleton) for each main program.
The Runtime object provides a mechanism for communicating directly with the virtual machine.  To get the Runtime instance, you can use the method Runtime.getRuntime(), which returns the Singleton.  Once you have the Singleton you can invoke the garbage collector  using the gc() method. Alternatively, you can call the same method on the System class,  which has static methods that can do the work of obtaining the  Singleton for you. System.gc(); Example  CheckGC.java
 
 
Class Loader     Loads all classes necessary for the execution of a program.  Bytecode Verifier   Java compilers perform extensive compile-time checking on the source code they compile. However, the  Java Virtual Machine  (JVM) cannot rely on compile-time checking because it has no way of determining whether the class files it interprets were produced by a trustworthy Java compiler or by a malicious user.   
Verifier serves to make sure that class files loaded into the JVM  respect certain security-related properties like •   the class file’s syntax,  •   the behavior of its code and  •   the potential interdependencies that it has with other class files.
Suppose If a buggy compiler generated a class file that contained a  method whose bytecodes included an instruction to jump beyond the  end of the method, that method could, if it were invoked, cause the  virtual machine to crash.  Thus, for the sake of robustness, it is important that the virtual machine  verify the integrity of the bytecodes it imports.

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Introduction To Java.
Introduction To Java.Introduction To Java.
Introduction To Java.
 
Java Development Kit (jdk)
Java Development Kit (jdk)Java Development Kit (jdk)
Java Development Kit (jdk)
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Java introduction
Java introductionJava introduction
Java introduction
 
QSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and JitQSpiders - Jdk Jvm Jre and Jit
QSpiders - Jdk Jvm Jre and Jit
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVA
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
JVM
JVMJVM
JVM
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
Java and its features
Java and its featuresJava and its features
Java and its features
 
The Java Story
The Java StoryThe Java Story
The Java Story
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 

Andere mochten auch

Andere mochten auch (8)

Md121 streams
Md121 streamsMd121 streams
Md121 streams
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
Md11 gui event handling
Md11 gui event handlingMd11 gui event handling
Md11 gui event handling
 
New features and enhancement
New features and enhancementNew features and enhancement
New features and enhancement
 
Md08 collection api
Md08 collection apiMd08 collection api
Md08 collection api
 
Md13 networking
Md13 networkingMd13 networking
Md13 networking
 
Md10 building java gu is
Md10 building java gu isMd10 building java gu is
Md10 building java gu is
 
Md09 multithreading
Md09 multithreadingMd09 multithreading
Md09 multithreading
 

Ähnlich wie A begineers guide of JAVA - Getting Started

Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
kumar467
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Murugesh33
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
10322210023
 

Ähnlich wie A begineers guide of JAVA - Getting Started (20)

basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecture
 
JAVA for Every one
JAVA for Every oneJAVA for Every one
JAVA for Every one
 
Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
 
Java notes
Java notesJava notes
Java notes
 
JVM Architecture – How It Works.pdf
JVM Architecture – How It Works.pdfJVM Architecture – How It Works.pdf
JVM Architecture – How It Works.pdf
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
Basic Java I
Basic Java IBasic Java I
Basic Java I
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Introduction to java programming tutorial
Introduction to java programming   tutorialIntroduction to java programming   tutorial
Introduction to java programming tutorial
 
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptxJAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
JAVA PROGRAM CONSTRUCTS OR LANGUAGE BASICS.pptx
 
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
 
Java JDK.docx
Java JDK.docxJava JDK.docx
Java JDK.docx
 
JVM.pptx
JVM.pptxJVM.pptx
JVM.pptx
 
1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx1 Module 1 Introduction.pptx
1 Module 1 Introduction.pptx
 
A Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMA Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVM
 

Kürzlich hochgeladen

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 

A begineers guide of JAVA - Getting Started

  • 1. Module 1 Getting Started
  • 2.
  • 3. Definition • A high-level programming language • O riginally called OAK . • In 1995 name changed to Java and also modified to take advantage of World Wide Web.
  • 4. How Java works • A program is both compiled and interpreted. • With the compiler, first you translate a program into an intermediate language called Java bytecodes • This platform-independent code is interpreted by the interpreter • The interpreter parses and runs each Java bytecode • Compilation happens just once • Interpretation occurs each time the program is executed.
  • 5.  
  • 6. Key Features of Java Programming Language 1. Platform Independence Java compilers do not produce native object code for a particular platform but rather ‘byte code’ instructions for the Java Virtual Machine (JVM). 2. Object Orientation Java is a pure object-oriented language. This means that everything in a Java program is an object and everything is descended from a root object class.
  • 7. 3. Rich Standard Library The Java environment includes hundreds of classes and methods in six major functional areas. 1. Language Support 2. Utility 3. Input/output 4. Networking 5. Abstract Window Toolkit 6. Applet 4. Familiar C++ like Syntax 5 . Garbage Collection - Java does not require programmers to explicitly free dynamically allocated memory. This makes Java programs easier to write and less prone to memory errors.
  • 8.
  • 9.  
  • 10.  
  • 11.  
  • 12. Java Virtual Machine Functionality • Provides hardware platform specifications • Reads compiled byte codes that are platform independent • The Java interpreter installed on your computer implements the Java VM.
  • 14.
  • 15.
  • 16.
  • 17.  
  • 18. Consider MyClass myRef = new MyClass(); this creates an object somewhere in the heap, it also creates a reference variable called 'myRef' that effectively points to the spot in the heap where the object is. Consider the right side indicates the heap and left side is list of references, draw an arrow to show where each ref is pointing to. MyClass ref2 = myRef; We have two things on the left, each with an arrow pointing to the single object on the right.
  • 19. Go through the code line by line, drawing and erasing arrows as Needed, you can then see when an object has no arrows pointing to it, thus making it eligible for garbage collection. Ways to call garbage collector algorithms In reality, it is possible only to suggest to the JVM that it perform garbage collection. However, there are no guarantees the JVM will actually remove all of the unused objects from memory. The garbage collection routines that Java provides are members of the Runtime class. The Runtime class is a special class that has a single object (a Singleton) for each main program.
  • 20. The Runtime object provides a mechanism for communicating directly with the virtual machine. To get the Runtime instance, you can use the method Runtime.getRuntime(), which returns the Singleton. Once you have the Singleton you can invoke the garbage collector using the gc() method. Alternatively, you can call the same method on the System class, which has static methods that can do the work of obtaining the Singleton for you. System.gc(); Example CheckGC.java
  • 21.  
  • 22.  
  • 23. Class Loader Loads all classes necessary for the execution of a program. Bytecode Verifier Java compilers perform extensive compile-time checking on the source code they compile. However, the Java Virtual Machine (JVM) cannot rely on compile-time checking because it has no way of determining whether the class files it interprets were produced by a trustworthy Java compiler or by a malicious user.  
  • 24. Verifier serves to make sure that class files loaded into the JVM respect certain security-related properties like • the class file’s syntax, • the behavior of its code and • the potential interdependencies that it has with other class files.
  • 25. Suppose If a buggy compiler generated a class file that contained a method whose bytecodes included an instruction to jump beyond the end of the method, that method could, if it were invoked, cause the virtual machine to crash. Thus, for the sake of robustness, it is important that the virtual machine verify the integrity of the bytecodes it imports.