Inside JAVA – Part 1
Feature of JAVA programming language:-
- Simple
- Pure object oriented
- Architectural neutral
- Platform independent
- Compiled and interpreted
- Security
- Robust
- Distributed
- Dynamic
- Multithreading
- Extensive
From above we get,
- JAVA is simple, because, JAVA removes the virtual, friend, pointer concepts which are from C and C++.
- We can write a JAVA code anywhere and run it. So, it is called as WORA means Write Once Run Anywhere.
- JAVA is Robust, because, it has a strong exception handling.
- JAVA provides all functionality at the runtime. So, it is dynamic.
Java uses the following features to fulfill the previously listed goals:
- The JVM
- Garbage collection
- The JRE
- JVM tool interface
The Java Virtual Machine:-
- The JVM is an imaginary machine that is implemented it in a software on a real machine.
- The Java Virtual Machine provides hardware platform specifications to which you compile all the java technology codes.
- This specification enables the java to be platform independent, because the compilation is done for a generic machine, known as JVM.
- Compiler takes the java source code and generates a bytecode.
- Bytecodes are the machine code instructions for the JVM.
- Bytecode are stored in a .class file.
- The JVM specification provides a concrete definitions for the implementation of:
1) Instruction set
2) Register set
3) CPU
4) Garbage collected heap
5) A memory area
6) Fatal error reporting mechanism
7) High precision timing support
- The coding format of JVM consists of compact and efficient byte-codes.
- Type checking is done at compile time.
Garbage collection:-
- When we run a java program memory for that program is allocated inside the memory of the JVM.
- When JVM runs 1st time it sends the requirement to the OS for particular amount of a memory.
- OS allocates a memory to the JVM and allocated memory is managed by the JVM.
- Managing this memory means allocating the memory for particular reference or de-allocating the memory which is not referenced.
- And this memory is called as managed memory.
- When OS allocates a memory for the JVM. The JVM initialized that memory to 0 that’s why each and every member is initialized with 0 by default.
- When we allocate a memory for a java program the reference of that memory is kept by the JVM.
- If that reference is pointing such a memory which is not in used by any other program that memory is considered as unreferenced memory.
- In the JVM garbage collector is a thread which scan a memory of JVM periodically.
- While scanning if it found some memory which is unreferenced that memory is collected by the garbage collector.
- For de-allocating memory garbage collector uses reference count concept similar as OS.
- According to above description we can predict that we cannot decide the execution of a destructor, because, the garbage collector is called periodically.
- Means we cannot predict when the finalize method is called.
For more reading about technology news in singapore and seo to online marketing do view more about other pages.