2. What is Java?
Java is a Object Oriented Programming
Language.
Thinks only objects and follows Object
Oriented Methodology.
It is also a technology.
Provide to develop - stand alone, web based and
micro/mobile based application/software.
1
3. Java programming
It has:
o Variables
o Data types
o Arrays
o Functions/methods
o Control statements
o Etc.
2
5. Data type
Define the data structure
Identify type of value/data
25 9.5
aa bb
10101 10111
1818
10010
ageage
““Ram”Ram”
11010
namename
intint floatfloat
intint
StringString
Water- (Value)
Liquid- (Type)
Bottle- (Variable)
4
6. Array
It is the collection of similar type of value and data
that hold in continuous location
Location or index is start at 0 position
int age[]= new int[10];
age[0] = 10;
age[1] = 20;
age[2] = 30;
age[3] = 40;
age[4] = 50;
Or
int ag[]={10,11,13,15,17,19};
5
8. Control Statement
Control the flow of program
Decision making statement:
oif…else
oswitch
obreak
oetc.
Looping statement
ofor
owhile
odo...while
7
10. Object has state & behavior
State store value – variable
Behaviour perform operation and change state –
Method/Function
State (variable) and Behaviour (method) of an
object are defined by class.
State 1
Value – stand up
State 2 changed
Value- stand up and
raise hand 9
11. Class
Class is the structure/blueprint/design/skeleton of
an object.
First create structure of an object and after
allocate memory to it, or create physical existence
in real world
It contains variables (attribute) and methods.
10
13. Object and class
Java program structure is class
When class have memory then java program is
object.
Class contains variables and methods it also
contain object.
class Calculater{
…..
code…
....main(..){
...}...
}
Output
Sum result is: 67
…
…
Structure
Run in real life
(Object)
12
14. Hello Program
public class HelloJava{
public static void main(String args[]){
System.out.println(“Hello Java”);
}
}
Access Modifier Keyword (Written inSmall Letters)
Main Method – program execution
start from here
Class name should start
capital letter and after it camel
case
println( ) method used to print at
console
Output:
Hello JavaHello Java
Assign memory
once
13
15. Run Program
Crate folder named “VidyutTech”
Open editor like – notepad, sublime etc.
Write program and save it with its class name and
with .java extension
Now open command prompt
cd VidyutTech
javac HelloJava.java
java HelloJava
Folder name
Compile Program
Run Program
JVM
Compiler
14