Updates
  • Starting New Weekday Batch for Java Full Stack Developer on 24th June 2024 @ 02:00 PM to 04:00 PM
  • Starting New Weekend Batch for Java Full Stack Developer on 06th July 2024 @ 11:00 AM to 02:00 PM
  • Starting New Weekday Batch for Java Full Stack Developer on 08th July 2024 @ 04:00 PM to 06:00 PM
  • Starting New Weekday Batch for Java Full Stack Developer on 29th July 2024 @ 10:00 AM to 12:00 PM
Join Course

Important Terminologies


1. Source Code

• A code which is written by programmer or developer is called source code.or
• Source code refers to the high-level code or assembly code that is generated by a human or programmer.or
• In simple words, we can say that source code is a set of instructions or commands and statements which is written by a programmer by using a computer programming language like C, C++, Java, Python, Assembly language.

Note:
• We can save the Java source code using any name, without space.
• We must save the source code with .java extension.

Example:

            
class A { 
    public static void main(String [] args) {
        System.out.println("-----------This is the main method in A class-------");
        System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10);
     }
  }
            
        
    -----------This is the main method in A class-------
    55
            


Note:
We cannot save the Java source code with space.

Example:

            
class A { 
    public static void main(String [] args) {
        System.out.println("-----------This is the main method in A class-------");
        System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10);
     }
  }
            
        
    -----------This is the main method in A class-------
    55
            


So, we cannot save our source code with space, if we do so we will get a compile time error.

Q. Why we cannot save our source code with space?

The compiler reads terms without space as the source code name, if a space occurs in between then compiler does not read beyond the space ,for example if we save source code as Second Test.java instead of SecondTest.java, then the compiler can read only Test.java and hence in this case we will get error message.

2. Java Compiler

• Compiler is a program which helps to translate the Java source code into bytecode. or
• It is a program with the name of javac.exe which is mainly responsible for checking the grammar of the programming language.
• It is also generates ‘.class’ file after the successful compilation of the program file with the name of class, interface or enum

Syntax:

javac <File_Name>.java

In the above image you can see there is one file which is javac.exe, this is Java Compiler.
If we change thefile name or remove this file from bin folder then javac cmd (javac command) will not work.

In the above image you can see there is no javac.exe file in bin folder because I have deleted this file and now when I try to run javac command over the command prompt, I get an error message

In the above image you can see we have an error, it denotes that the operating system is not able to recognize javac cmd as internal or external cmd.

3. Byte Code

• After the successful compilation of a Java source code, byte code will be generated which contains by.class files.
• That byte code will be processed further while running the Java program.

Q.1 Who is responsible to generate the Byte Code?

Ans. Java Compiler

Q.2 What will be the name of .class file after successful compilation?

Ans. The name of .class file depends on the name of the class which we have declared in the source code.

Q.3 How many .class files can we get after successful compilation of a source code?

Ans. On demand we can declare more than one class in same Source Code. . Number of .class files depends on the number of classes declared in the source code.

Q.4 Which .class file can we use at the time of execution?

Ans. At the time of the execution we can use only those .class files which have main(), otherwise we get an error: MainMethodNotFound

Q.5 Is it possible to change the .class file content manually?

Ans. No, if we change then we will get error, such as: java.lang.UnsupportedClassVersionError

In the above image you can see we have a simple java program which prints the sum of 1 to 10.

You can see that after successful compilation we have A.class file.


Now I’m using A.class file, at the time of execution we get error such as : java.lang.UnsupportedClassVersionError, it is because JVM is not able to execute edited .class file.

4. JIT (Just in Time) Compiler

• The Just-In-Time (JIT) compiler is a component of the JVM that improves the performance of Java applications at run time. means
• It improves the performance of Java programs by compiling bytecodes into native machine code at runtime.

5. Native Code or Executable Code

• Native code or executable code or machine code contains all the instructions in binary form as well as the Operating System compatible codes that help to run the executable codes on Operating System directly.

Example:
All the setup files of any application are the executable code.

That is the reason that we generally get different setup files for different Operating Systems (Such as: Windows 64 bit, Widows 32 bit, Linux, Mac, etc.)

6. Java Virtual Machine (JVM)

• JVM is specifically responsible for converting bytecode to machine-specific code and is necessary in both JDK and JRE.
• JVM is platform-dependent and performs many functions, including memory management and security.
• JVM is an implementation which has sub implementations and every sub implementation has their own task and the main role of the JVM implementation is to run the Java Application or Program or .class file.

7. Java Runtime Environment (JRE)

• JRE is software that includes JVM and class libraries to run java programs independently and it can execute the code.
• JRE is an implementation which is basically used to provide resource to the JVM to run the Java application.
Note: It does not include separate tools such as a debugger for Java development.

JRE = JVM + Class Libraries (For run the Java applications).

8. Java Development Kit (JDK)

• JDK in Java is an abbreviation for Java Development Kit.
• It is a bundle of software development tools and supporting libraries combined with the Java Runtime Environment (JRE) and Java Virtual Machine (JVM).