0% found this document useful (0 votes)
6 views5 pages

Java Theory

Java is a high-level, platform-independent programming language developed by James Gosling in 1995, known for its 'Write Once, Run Anywhere' capability. The document explains key concepts such as the main method, the difference between compilers and interpreters, and the roles of JVM, JDK, and JRE. It also outlines the features of Java, including its simplicity, object-oriented nature, and robustness.

Uploaded by

sharanyav810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Java Theory

Java is a high-level, platform-independent programming language developed by James Gosling in 1995, known for its 'Write Once, Run Anywhere' capability. The document explains key concepts such as the main method, the difference between compilers and interpreters, and the roles of JVM, JDK, and JRE. It also outlines the features of Java, including its simplicity, object-oriented nature, and robustness.

Uploaded by

sharanyav810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

JAVA THEORY

1.​WHAT IS JAVA ?
●​ Java is a high-level programming language which is platform
independent. It is an object-oriented programming language.
●​ Write Once and Run Anywhere (WORA), meaning that compiled Java
code can run on all platforms that support Java without the
need for recompilation.
●​ Java was developed by James Gosling at Sun Microsystems Inc.
in May 1995 and later acquired by Oracle Corporation and is
widely used for developing applications for desktop, web, and
mobile devices. Case sensitive.

2.​WHAT IS PUBLIC STATIC VOID MAIN(TSRING [] ARGS) ?


●​ Public:public is an access modifier which allows access to the
class from anywhere.​
It means the method will be visible from classes to in other
packages.​

●​ Static:Static is a keyword which helps main method to run


without creating any objects.

●​ Void:It is a keyword used when we don't want to return


anything from a method/Function.

●​ Main():main is the default signature defined in JVM.


Whenever you try to run a java file ,first it looks for the
main function without the main in it not run.
Main method is an entry point for a java program for JVM.

●​ String[]Args:It is used to command line argument for string


type array.

3.​WHAT IS SYSTEM.OUT.PRINTLN()?

●​ SYSTEM:It is a final class from the java.lang package.


●​ OUT:It is a class variable of type PrintStream declared in
the system class.It is static accessed using class name.
●​ Println():It is a method of the printstream class.
4.​ Difference between Compiler and Interpreter.
COMPILER INTERPRETER

●​ Converts whole code at ●​ Checks and translates each


once into bytecode. line of bytecode at a time
●​ If it encounter error it into opcode.
do not provide byte code ●​ Stops translating once it
even for single line. finds an error in a line.
●​ Instead it gives out an
error message.
5.​How Java Works ?

1.Instruction/Programs:Tests/Checks code for errors.


2.Remove space and extra lines.
3.Breaks the instructions.
4.Maps function call to its body.
5.Converting program to machine (opcode)(0&1)

●​ 1-4 steps are done by the compiler.


●​ 5th step JRE does.
●​ Hello.class :Is a bytecode[intermediate code] Platform
Independent Ready to Execute Code.
●​ JVM->JRE->converts bytecode to opcode(0,1) .​
Class loader file->Interpreter->opcode(0,1).
●​ Processor gives output.
●​ JRE​
Separate for each software [Windows,linux,Mac].​
Interpreter.
6.​WHAT IS JVM,JDK AND JRE ?​

JVM[JAVA VIRTUAL MACHINE]


●​ Executes the java program line by line.
●​ Important for both JRE and JDK as it is inbuilt in both.
●​ Program using JRE and JDK goes into JVM.​

JDK[JAVA DEVELOPMENT KIT]


●​ Provides an environment to develop and execute the java
program.

JRE[JAVA RUNTIME ENVIRONMENT]


●​ It allows us only to execute.We cannot develop java programs.
●​ It is designed for the end users of the system.
●​ Consists of libraries and files that JVM uses at the runtime.​

7.​ FEATURES OF JAVA?


1.Simple​
2.Object-oriented​
3.Robust.
4.Platform-Independent​
5.Multithreaded​
6.Portable​
7.High-performance
8.Dynamic

You might also like