Java Notes Day 0

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

What is programming language in general?

A programming language is a special language that computers understand.


It's like giving commands to a computer or a robot using words and symbols.

Y
You use these commands to tell the computer what to do, step by step.

EM
Just like you follow instructions to play a game or build with blocks,

AD
computers follow the instructions you give them using a programming

AC
language. You can tell the computer to do all sorts of things like drawing
shapes, playing music, or solving math problems.

R
TE
Different programming languages have different rules and words, just like
PU
different games have different rules and words. Some popular programming
languages you might have heard of are Python, JavaScript, and Java.
M
O
C

People use programming languages to create all kinds of cool stuff, like video
N

games, websites, and apps. It's like having a secret code to make the
O

computer do amazing things!


TI
VA

So, a programming language is like a way for you to talk to computers and
O

make them do what you want. It's a superpower that lets you create and
N

bring your ideas to life. How cool is that?


IN
E
TH
Note:
Before you learn any programming language, it is important for one to
understand some of the basics about computer and what are the languages
that a computer can understand.

Y
Let's have a view on it.

EM
A computer is a collection of hardware components. Let us consider here few

AD
hardware components such as:
Hardware Components: CPU, RAM, ROM, Keyboard, Printer, Monitor, etc.

AC
Language is the main medium for communicating between the computer

R
TE
systems. A program is a collection of instructions that can be executed by a
computer to perform a specific task.
PU
M
There were several programming languages used to communicate with the
O

Computer.
C
N

1. MLL (Machine Level Language)


O
TI
VA
O
N
IN
E
TH

Codes written in 1940’s as


To perform addition of two numbers: 0110110
To perform subtraction of two numbers: 1110111
2. ALL (Assembly Level Language)

Y
EM
AD
AC
R
TE
The problem with Machine level code approach was decided to be changed in
PU
the year 1950’s. They thought that instead of writing a long sequence of 0’s
M
and 1’s a single instruction can be given.
O
C

3. HLL (High Level Programming Language)


N
O
TI
VA
O
N
IN
E
TH

People always want the things to be simple and easier so, in 1960’s they
came up with next type of language called High Level Programming
Language.
High Level Languages are written in a form that is close to our human
language, enabling the programmer to just focus on the problem being solved.
Example: Python, Java, C++, JavaScript etc.

Compiler vs Interpreter

Y
EM
AD
AC
R
TE
PU
M
O

Compilation: In compilation the entire HLL program is converted to MLL in


C

one shot by the compiler.


N

Interpretation: In interpretation, at any given point of time only a single line


O

of HLL program is converted to MLL which is then executed by CPU.


TI
VA
O
N
IN

About Java:
E
TH

Java is an object-oriented, class-based, secured and general-purpose


computer-programming language. It is a widely used robust technology.
or
Java is a programming language and a platform. Java is a high level, robust,
object-oriented and secure programming language.
Java was developed by Sun Microsystems (which is now the subsidiary of
Oracle) in the year 1995. James Gosling is known as the father of Java.
Before Java, its name was Oak. Since Oak was already a registered company,
so James Gosling and his team changed the name from Oak to Java.

Platform: Any hardware or software environment in which a program runs, is

Y
known as a platform. Since Java has a runtime environment (JRE) and API, it

EM
is called a platform.

AD
AC
Applications of Java:

R
TE
● Desktop Applications such as Photoshop, VLC Media Player, antivirus,
etc.
PU
M
● Web Applications such as irctc.co.in, youtube.com etc.
O

● Enterprise Applications such as banking applications.


C

● Mobile
N

● Embedded System
O

● Robotics
TI

● Games, etc.
VA
O
N
IN

Types of Java Applications:


E
TH

● Standalone Applications
● Web Applications
● Enterprise Applications
● Mobile Applications
Y
EM
AD
AC
R
⭐ Popularity of Java: TE
PU
M
O

According to TIOBE's programming language index ranking, Java maintains


C

its popularity due to its versatility, scalability, and extensive libraries.


N
O

And currently Java is ruling the index ranking 4th in the world.
TI
VA
O
N
IN
E
TH
Java Version History:

The latest version of Java is Java 20 or JDK 20 released on March, 21st


2023, JDK 20 is a regular update release, and JDK 17 is the most recent
Long Term Support (LTS) release of Java SE platform (about 8 years of

Y
support from Oracle).

EM
AD
AC
R
TE
PU
M
O
C
N
O
TI

Java Platform Editions:


VA
O
N

Java platforms are divided into four editions, Java Standard Edition (Java
IN

SE), Java Enterprise Edition (Java EE), Java Micro Edition (Java ME) etc.
E
TH

The Three Types of Java:


1. Java Standard Edition (Java SE),
2. Java Enterprise Edition (Java EE), and
3. Java Micro Edition (Java ME).

We will use Java SE edition:


The Java Platform Standard Edition (Java SE) is made up of APIs
(Application Programming Interfaces) that provide Java's fundamental
programming features. It specifies every aspect of the Java programming
language, from its fundamental types and objects to its high-level classes
for security, Graphical User Interface development, database manipulation,
networking, etc.

Y
EM
The Java SE Platform Includes:

AD
● JVM (Java Virtual Machine),

AC
● JDK (Java Development Kit),

R
● JRE (Java Run-time Environment)

TE
PU
JVM(Java Virtual Machine):
M
O
C

JVM (Java Virtual Machine) is an abstract machine that enables your


N

computer to run a Java program.


O
TI

When you run the Java program, Java compiler first compiles your Java code
VA

to bytecode. Then, the JVM translates bytecode into native machine code
O

(set of instructions that a computer's CPU executes directly).


N
IN

Java is a platform-independent language. It's because when you write Java


E

code, it's ultimately written for JVM but not your physical machine
TH

(computer). Since JVM ​executes the Java bytecode which is


platform-independent, Java is platform-independent.
JRE(Java Runtime Environment):

JRE (Java Runtime Environment) is a software package that provides Java


class libraries, Java Virtual Machine (JVM), and other components that are

Y
required to run Java applications.

EM
AD
AC
R
TE
PU
JDK(Java Development Kit):
M
The Java Development Kit (JDK) is a software development environment
O

which is used to develop Java applications. It physically exists. It contains


C

JRE + development tools.


N
O
TI
VA
O
N
IN
E
TH
Tools for development:

JDK Version: LTS Version of latest release (ex. JDK-17)

IDE (Integrated Development Environment): Eclipse/Netbeans/IntelliJ

Y
EM
Code Editor: Visual Studio Code/Sublime-Text/Notepad++

AD
AC
R
Execution of Java Program:

TE
PU
When we compile Java program using javac tool, the Java compiler converts
M
the source code into byte code.
O
C
N
O
TI
VA
O
N
IN
E
TH
Syntax of java code:

Y
EM
AD
AC
R
TE
PU
Imagine you're writing a note to a friend in a language only your computer
M
understands. Here's what you'd write for the "Hello, World!" program:
O
C

Title the Note:


N

You start by giving your note a title, so your computer knows which note to
O

read.
TI
VA

public class HelloWorld {


O
N

Write the Message:


IN

Inside the note, you write the message you want your computer to show.
E

public static void main(String[] args) {


TH

// Show the message


}

Show the Message:


You tell your computer to show the message "Hello, World!" on its screen.
System.out.println("Hello, World!");
TH
E
IN
N
O
VA
TI
O
N
C
O
M
PU
TE
R
AC
AD
EM
Y

You might also like