introduction to JAVA

introduction to JAVA

introduction to JAVA

introduction to JAVA

introduction to JAVA
introduction to JAVA


What Is the Java Programming Language?



• The Java programming language is:

• A programming language
• A development environment
• An application environment
• A deployment environment

• Similar in syntax to C++; similar in semantics to SmallTalk

• Used for developing both applets and applications

 

Primary Goals of the Java Programming Language


• Provides an easy-to-use language by:

• Avoiding the pitfalls of other languages
• Being object-oriented
• Enabling users to create streamlined and clear code

• Provides an interpreted environment for:

• Improved speed of development
• Code portability


• Enables users to run more than one thread of activity

• Supports dynamically changing programs during runtime

• Furnishes better security

 

The following features fulfill these goals:


• The Java virtual machine (JVM)

• Garbage collection

• Code security

 

The Java Virtual Machine


• Provides hardware platform specifications

• Reads compiled byte codes that are platform independent

• Is implemented as software or hardware

• Is implemented in a Java technology development tool or a Web browser

• JVM provides definitions for the:

• Instruction set (central processing unit [CPU])
• Register set
• Class file format
• Stack
• Garbage-collected heap
• Memory area

• Bytecodes that maintain proper type discipline from the code.

• The majority of type checking is done when the code is compiled.

• Every Sun approved implementation of the JVM must be able to run any compliant class file.

 

Garbage Collection


• Allocated memory that is no longer needed should be deallocated

• In other languages, deallocation is the programmer’s responsibility

• The Java programming language provides a systemlevel thread to track memory allocation

• Garbage collection:

• Checks for and frees memory no longer needed
• Is done automatically
• Can vary dramatically across JVM implementations

 

Java Runtime Environment


• Performs three main tasks:

• Loads code
• Verifies code
• Executes code

 

Class Loader


• Loads all classes necessary for the execution of a program

• Maintains classes of the local file system in separate "namespaces"

• Prevents spoofing

 


Bytecode Verifier

Ensures that:


• The code adheres to the JVM specification

• The code does not violate system integrity

• The code causes no operand stack overflows or underflows

• The parameter types for all operational code are correct

• No illegal data conversions (the conversion of integers to pointers) have occurred