You are on page 1of 16

INTRODUCTION TO

JAVA
DAY 1
JAVA
• Java is a powerful, versatile, and simple general-purpose programming language.
• It is one of the most widely used high-level programming languages in the world.
• It is used for developing platform-independent software (applications) running on
desktop computers, mobile devices, and servers.
• From the beginning, Java attracted programmers to own because programmers can run
Java programs from a web server. Such programs are called applets.
HISTORY OF JAVA
Several java versions have been released till now. They are as follows:
1. JDK Alpha and Beta (1995): The JDK Alpha and Beta was the first release in 1995 but they have highly unstable APIs and
ABIs.
2. JDK 1.0 (23rd Jan 1996): JDK 1.0 was the first stable released version of Java. Its code name was Oak. The first stable
version of JDK was JDK 1.0.2 and it was named Java 1.
3. JDK 1.1 (19th Feb 1997)
4. J2SE 1.2 (8th Dec 1998)
5. J2SE 1.3 (8th May 2000)
6. J2SE 1.4 (6th Feb 2002)
7. J2SE 5.0 (30th Sep 2004)
8. Java SE 6 (11th Dec 2006)
9. Java SE 7 (28th July 2011)
10. Java SE 8 (18th Mar 2014)
11. Java SE 9 (21st Sep 2017)
12. Java SE 10 (20th Mar 2018)
JVM
• The Java Virtual machine (JVM) is the virtual machine that runs on actual
machine (your computer) and executes Java byte code.
• The JVM doesn’t understand Java source code, that’s why we need to have javac
compiler that compiles *.java files to obtain *.class files that contain the byte
codes understood by the JVM.
• JVM makes java portable (write once, run anywhere). Each operating system has
different JVM, however the output they produce after execution of byte code is
same across all operating systems.
Difference between JDK, JRE and JVM
JDK JRE JVM
JDK stands for Java JRE stands for Java JVM stands for Java
Development Kit Runtime Environment Virtual Machine.
It contains everything JRE contains Java Java Virtual Machine
that JRE has along virtual Machine(JVM), (JVM) is a virtual
with development class libraries, and machine that resides
tools such as other files excluding in the real machine
compiler, debugger development tools (your computer) and
etc. such as compiler and the machine language
debugger. for JVM is byte code
JDK is a superset of It is a subset of JDK. JVM is a subset of
JRE JRE.
JDK is used to create JRE is a part of JDK JVM is used to run the
and compile Java that contains JVM. java code on any
• A variable is used for holding the name or value of a memory location. It
means the variable is just like a container that has value in it.For example, we
have a box and pen here box is a container that contains a pen in it.

• We have three types of variables. it is used for a different purpose. Local


variable: It is a variable that is available inside only in the body of the method.
scope of local variable is only within the method. even the class does not know
whether this variable exists or not.

• Instance variable: It is a variable that is available inside a class of body and


outside the method .it is accessed through the object of the class. we can’t
directly access it.

• Static variable: It is a variable that is available inside the class of body and
outside method. It doesn’t require any object to access the value of it. we
directly access it.
Local variable : 
class Student{
public static void main(String[] args) {
int student_id = 101; // local variable
System.out.println(student_id);
}
}

Instance variable:
class Student{
int student_id = 101; // instance variable
public static void main(String[] args) {
Student s = new Student();
System.out.println(s.student_id);
}
}

Static variable:
class Student{
static int student_id = 101; // static variable
public static void main(String[] args) {
System.out.println(student_id);

You might also like