Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Java Introduction
What is a Java ?
Java is programming language and computing platform. There are lots
of application and websites that will works unless you have a java
installed.
Is created by James Gosling
JDK vs JRE vs JVM
• JDK --- Java Development Kit
• If we want to write a code then we required JDK in our system.
• JDK provide a development kit for develop a program
• When you download JDK, JRE is also downloaded, and don't need to
download it separately. In addition to JRE, JDK also contains number of
development tools (compilers, Javadoc, Java Debugger etc.).
JDK vs JRE vs JVM
• JRE------ Java Runtime Environment
• JRE provide the environment to execute the code.
• That why we are call system independent programing language
• Simply if we have JDK in our system then we will execute program easily.
JDK vs JRE vs JVM
• JVM---- Java Virtual Machine
• That will actual run the code and it’ll provide compiler that call javac
• JVM (Java Virtual Machine) is an abstract machine that enables your
computer to run a Java program.
• When you run the Java program, Java compiler first compiles your Java
code to byte code. Then, the JVM translates byte code into native machine
code (set of instructions that a computer's CPU executes directly).
• Java is a platform-independent language. It's because when you write Java
code, it's ultimately written for JVM but not your physical machine
(computer). Since, JVM executes the Java byte code which is platform
independent, Java is platform-independent.
Java Complete Structure in the diagram
What is a class
• Class is a collection of variable or method
• Variable ---------which stores the value and value can be change data type
variable name
Example for define a variable
int integerValue; float floatValue; double doubleValue;
String StringValue; char charcterValue;
• Method-----is a actual logic of your need. Is a main method is the entry point
of execution
What is an object & why we are create ?
• Object is a state and behaviors
• Object is the core concept of object oriented programming language.
• Object is create for access a variable or methods.
• Example
Public ClassA
{
public ClassA(){}// this is default constructor
public ClassA(int a){} // parameterized constructor
}
This is constructor
example with this
keyword
This keyword is user for
call another
constructor with
In the class
Constructor Second example with void methods
Extends and super() keyword
• - Extends is user for inherit the parent class class method to child class
• super() keyword is similar to this() keyword but
• super() keyword is user for call another class constructor