|
| 1 | +# Basic Concept - Theoritical Updates |
| 2 | + |
| 3 | +In this particular Markdown, we have further updates regarding the left one concepts of Basics of Java which are important for Beginners, together by having the [Codes](https://github.com/ackwolver335/Java-Coder) and the main Markdown file of Basic [Java](https://github.com/ackwolver335/Java-Coder/blob/main/README.md) regarding the code integrated Concepts. |
| 4 | + |
| 5 | +## Contents to be Studied |
| 6 | + |
| 7 | +1. Java as OOPs |
| 8 | +2. History of Java |
| 9 | +3. Difference of Java and C++ |
| 10 | +4. Java Architecture |
| 11 | + |
| 12 | +## Java as OOPs |
| 13 | + |
| 14 | +When we talk about OOPs, not just in Java in other programming language also we starts using *Objects* in Programming in order to implement them as **Primary** source to create something with the code. As the objects are seen by the user in order to perform different tasks. |
| 15 | + |
| 16 | +OOPs usually aims for the implementation of real world Objects in Programming like **Inheritance**, **Data Hiding**, **Polymorphism**,..etc Also the main aim is to bind the Data and the functions (Operates on Object/Data) so that not any other part can access the Data. |
| 17 | + |
| 18 | +**Access Modifiers** : The Access regarding usage outside and inside the class over to its member is been defined or modified using these access modifiers. |
| 19 | + |
| 20 | +**Class** : We can consider it as a *Blueprint* or *Prototype* with the help of which the Objects are created. It is used in order to represent a particular set of members and methods to one or more objects. It reduces the redudancy of code with the help of using a particular class multiple times in order to create multiple objects of it. |
| 21 | + |
| 22 | +**Objects** : It is to be considered as a Basic Unit of OOPs which is used to represent the Real-Life *Entities*. A General Java program is been implemented with different kinds of Objects. And these are the part of the code visible to the users or viewers. |
| 23 | + |
| 24 | +### Important Keypoints |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +### Basic Terminologies and Concepts |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +## History of Java |
| 33 | + |
| 34 | +- Developed by - **James Gosling** in *1990* |
| 35 | +- Project was called as **GreenTalk** regarding development of JAVA |
| 36 | +- Further it was named as **OA** |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +## How Java and C++ are Different ? |
| 41 | + |
| 42 | +| **Java** | **C++** | |
| 43 | +| -------- | ------- | |
| 44 | +| Regarding Memory Management it supports *Threads*,*References* and *Interface*, also don't supports *Pointers* | Regarding Memory Management it uses *Pointers*,*Structures* and *Unions* | |
| 45 | +| Have Wide-Range of *Libraries* or *Classes* regarding different High-Level of Services | As per comparison have Low-Level of *Functionality* | |
| 46 | +| Supports Inheritance but in case of Multiple uses *Interfaces* | Supports both Single and Multiple *Inheritance* | |
| 47 | +| Don't supports *Operator Overloading* | Supports *Operator Overloading* | |
| 48 | +| For Handling *Programs*, functions and variables resides inside the *classes* and *packages* only | Regarding this feature functions and variables reside outside the *classes* | |
| 49 | +| It is *Platform-Independent* as the generated *Byte-Code* runs on every OS | It is *Platform-Dependent* and the code needs to *recompiled* for running on different OS | |
| 50 | +| It supports *Threads* and Concept of *Multi-Threading* | Don't have Built-in feature for *Threads* and is dependent on *Libraries* | |
| 51 | + |
| 52 | +## JVM Architecture |
| 53 | + |
| 54 | +JVM acts or works like a run-time engine for running JVM Applications. It is reponsible for the calling of the *main* method present in the Java Code for its execution, and further its is a Part of **JRE** (Java-Runtime Environment). We can used the *WORA (Write Once Run Anywhere)* property of Java only because of JVM. |
| 55 | + |
| 56 | +When a Java File with *.java* extension is been compiled, then a *.class* is been generated by the **JIT** *(Just In Time)* Compiler. For running the code, this *.class* file is been passed through various purpose. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +### Class Loader Sub-System |
| 61 | + |
| 62 | +It includes 3 properties or functions further process as mentioned below :- |
| 63 | + |
| 64 | +- **Loading** -> Firstly, the loader reads the *.class* file and generates its *Binary Code* together by saving it into the *Method Area*. For each *.class* file JVM stores (i) Fully Qualified Name of Loaded Class, (ii) Class, Enum or Inteface if available together by its properties like *methods*, *members*,..etc |
| 65 | + |
| 66 | +It also creates an Object of type *class* to represent the file in *Heap Memory*. |
| 67 | + |
| 68 | +- **Linking** -> Performs *Verification*, *Preparation* and sometimes *Resolutions*. Verification is the process in which we get the ensurity of the Correctness of the *.class* file, whether its is properly formatted or not and this verification is done by *ByteCodeVerifier*. In case of Preparation, the JVM allocates memory for class static variable and initialize it the default values. In Resolution, the replacement of *Symbolic Reference* to *Direct Reference* is done by searching in the Methods Area to locate referenced entity. |
| 69 | + |
| 70 | +- **Initialization** -> In this process, the static variables with *static* keywords are assigned their required values as per defined in the code, also it is done from top to bottom in case of *Classes* and from Parent to Child in case of *Hierarchy*. |
| 71 | + |
| 72 | +We also have following Loaders in **Initialization Phase** :- |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +### Different Memories of JVM |
| 77 | + |
| 78 | +- **Method Area** ->> In this all the properties of a *Class* together by the *static* variables are stored, also each JVM have only one Method Area together by being a shared resource. |
| 79 | +- **Heap Area** ->> All information regarding *Object* is included in it, and is only one for each JVM being a shared resources. |
| 80 | +- **Stack Area** ->> Run-time Stack is created for each thread by JVM. Its area is called as *Activation Record* or *Stack Frame*, when a thread is terminated its stack area is destroyed and it is not sharable resource. |
| 81 | +- **PC Registers** ->> Used to store address of current execution of thread and is provided seperately to each thread. |
| 82 | +- **Native Method Stack** ->> It is provided each to each thread and is created for storing *Native Information* regarding that thread. |
0 commit comments