- Java Virtual Machine
- Java class file format
- Java API
- Java programming language
- Is Object-oriented programming language,
- Does not allow implicit typecasting.
- Allows memory allocation using the new operator and ensures that objects are allocated memory
- Does not allow pointer arithmetic (a pointer is a reference to a variable or an object in memory)
- Allows the program to run on multiple platforms. Like Windows, linux, unix..
- No Operator Overloading, No Multiple Inheritance, No Friend Concept
- Is a binary code
- Makes the Java file network mobile and platform independent
- Is compact and can be transported easily and quickly.
- Is a set of .class files available at runtime
- These .class files are loaded when the program needs them
- Checks with the Security Manager before providing access to resources for a program.
- Is the heart of Java’s network orientation
- Is a software that interprets and executes the bytecode
- Starts the application by running the main() method
- Is responsible for loading .class files through various class loaders
- JVM class loaders can be classified as:
–Primordial class loader – loads the Java API classes when the program is executed
–Class loader objects – are created at runtime for loading the classes of the application


- Platform independence
- Security
- Network mobility
Platform Independence
- Is gained through the bytecode obtained after compilation
- Bytecode can be executed on any machine thus reducing the time and cost involved in creating applications
- Support is spread across all four components of the Java architecture – the Java language, the Java class file format, Java Virtual Machine and Java API
Security
Untrusted applets cannot:
- read or write to local files
- make a network connection to any other machine except from which it was downloaded load new dynamic link libraries
- call a native method
- Is implemented through the Java sandbox, which is a memory area outside which the Java programs cannot make calls
Java Sandbox
- Applies restrictions on applets through the following components:
- Bytecode verifier – checks the structure of the .class file, validity of classes, variables and methods used in the program
- Applet class loader – a Web browser installs a class loader, called an applet class loader, which requests for .class files from the HTTP server
- Security Manager – defines the boundaries of a sandbox. The Java API refers to the security manager before it allows access to any resource
Network Mobility
Is maintained through
- platform-independence
- security restrictions
- reducing the amount of time taken to download a program from the network
- Determines the objects that are no more referenced in a program and releases the memory allocated
- Garbage is the object which is not referred by a program any more
- The process of automatically freeing the memory of objects that are no more in use is called garbage collection.
- Reference-counting collector – keeps a count of the references to each live object
- Tracing collector – uses the mark-and-sweep approach in which the mark phase marks all the referenced objects, the sweep phase collects the garbage memory of unreferenced objects
- Compacting collector – reduces memory fragmentation by combining all the free spaces in memory into one unit during garbage collection
- Adaptive collector – monitors the situation and uses the garbage collection technique that best suits the situation
Avoids
- Memory leakage
- Memory corruption
Increases
- Is executed before the memory associated with an object is de-allocated
- Can also be called manually using System.gc() method
Has the following declaration:
protected void finalize() throws Throwable
{
super.finalize();
}
every class inherits the finalize() method from java.lang.Object; the method is called by the garbage collector when it determines no more references.
- An object becomes eligible for Garbage Collection when its last live reference disappears.
Three ways to get rid of the reference:





Recent Comments