JAVA
Programming Language
It is a set of instruction which is used to communicate with machine or
computer is known as Programming language
Types of Programming
Low Level Language
Mid Level Language
High Level Language
Low Level Language
The language which is easy to read and understand by the machine is
known as low level language
eg
Binary Language
Low Level language is difficult to understand by human beings to solve this
problem mid level language come into picture
Mid level languauge
The language which contains mnuemonics
Compare to Low Level Language ,Mid Level Language is understand by
human beings
Since Mid Level Language cannot be understand by computer we can install
Software as assembler Which will take the i/p as MDLL and converts into
Low Level Language
By using MDLL we cannot create a Application to solve this problem
High Level Language
The language which is similar to english is known high level language
It is easy to understand by the human begins when compared with mid
level language
eg
JAVA,Python,C,C++…
JAVA
• Java is a high level programming language and it was introduced by James
Gosling in the year 1995
• When he was working for sun microsystem company and this company was
acquired by create and hence ownership is shifted to Oracle company
• Using java we can create application
• Java Language Cannot be understand by machine
• So we can install software like compiler or interpreter to talk with machine
java 1 Page 1
• So we can install software like compiler or interpreter to talk with machine
Structure of java
class Classname{
Class is a component and it should be written in lower case
Every class have class name
Class name can be anything
As a programmer write the class name first letter in capital for undersatnd
Steps to write and run the java program
1. Open any one of the application -Notepad, VS code, Eclipse, Ms work ,
Editplus etc..
2. Write the java code according to the structure of java
3. save the file with .java extension
The file which contains java instruction is known as java file
4. Call the Compiler
Compiler is a software and the name of the compiler is javac
Compiler takes the input as java file and generate the output as
Classfile
Compiler will generate class file if and only if the java file syntactically
and semantically correct
How to call compiler
Syntax
Javac [Link]
Where will to call compiler?
Comment Prompt
Comment prompt is a application we can read (compile) and execute
(run the java program) based on the your comment
The file Which contains byte code is known as class file
Byte code is the intermediate code(Somethings are readable
Somethings are not readable)
And it cannot be understand by any one expect JVM
java 1 Page 2
5. Call JVM to convert byte code into low level language
Syntax
java Classname
This command has a python i.e Main method should be present in the
java file also we get RTE saying
Error: Main method not found in class Notes, please define the main
method as:
public static void main(String[] args)
or a JavaFX application class must extend
[Link]
Main method is the starting point of execution and it is called by JVM
class ClassName{
public static void main (String[] args){
}
}
CTE-COMPILE TIME ERROR
RTE-RUN TIME ERROR
Where all this process are carried out?
JDK software
JDK is a software and this JDK stands for java
Development kit
This JDk contains compiler JRE,JVM additional
development tools
If we install JDK in our system we can compile java
file and execute class file
JRE-architecture of java
► JRE is a software and JRE stands for JAVA RUNTIME
ENVIRONMENT
► This JRE contains JVM,JIT,Interpreter etc…
► JRE Provides an environment (memory) to convert JVM
byte code into Low Level Language
java 1 Page 3
byte code into Low Level Language
► If we Install JRE software inside our system are we
cannot compile the java code
► but we can execute the code
JVM
► JVM stands for Java Virtual machine
► JVM contains JIT and interpreter it is only
component in java which can be understand bitecode
and converts its into low level language
JIT
► JIT stands for Just In Time compiler
► It is responsible to covert Bytecode
and Interpreter
► It executes byte code line by line
Features of java
► Java is a platform independent language
► It follow WORA principle (Write Once, Run Anywhere)
► Java is high secured Language
► Java support multi threading
► Java is robust
► Java is Strictly typed language
► Java is strongly typed language
Understanding platform dependent language
The code which is written and compiled in one
platform will not be executed in any other
platform for this we called this as platform
depended language
java 1 Page 4
depended language
platform independent language
The code which is written and compiled in one
platform will be executed in any other supported
platform (JVM) that is called platform
independent language
Java is platform independent language but it is
dependent on jvm
NOTE
JAVA FOLLOW WORA that means Write Once Run Anywhere
Structure of java code
class ClassName{
public static void main (String[] args){
//STATEMENTS
}
}
java 1 Page 5