Java Handwritten
Java Handwritten
:
Giaclckto ms tomputur pioturtis option.
click. on. advanced 9ystem stting
cnvíonment variable (bottom
click. on meut tab a usesL
- write path" in varioble
tezt box vauiabe
Coßy ahehath. o dk tin
this in variable value.text box:
click on Ok buten .
click on. ok button
tavo Tokena Smallest individual
indvt£ual int+
in are Rn0uwn as token .Án
simble teans java fragseam
collection o tokens, ooMmen zs and.uit
shaces , Jáva lanquange includes these
ypes of tokens
Keyaords
Adentiflu.
iterals
v Oberators
`tharatore.
Yor'ables.
scoXe
can have
) and.
identiflesus.
albhabets
dollar Sian inteqes , unasr
They must not begin with a diatA.
(begcase lowexcase letters ° are disthot.
Thej can be of any leng h.
utesHals LtteralS în jav
-e of characteys (digits, lettexs $
odher chaxactcr) that srcbresents cons katt
Values to be stored nOLsiables
Tava. language sheciftes follaung tuyhes st
{loating botnt litera
Anteqes littrals strina lterals
Charactex iterals
Boolean Lterals
bATL
Constant
Numgaical Albhabe tlc.
Anteqet Real
chasactesx', St+5
(123,32) (-o.45,08) (5', )
99
) Yauiable-
A Vaxiable is an Sdetiflex shat denotes
DuL Stosage ocation lsed. to stoe a
dota Yalue .
Vaxiable. manes
Memay
consist st albhabe,
undegsco9Le ( and.
Saabe af Yautable dollaC).
Anstane Vasiable
)Class Vastable
ocal Variahle .
Anstance Vatable- Anstance & class
vaxiables are declaed nslde the class
Anstance varable are created when ohiect
aLe initiated and. dhesefoxe
associated. witt they ae.
Ohject.
Class Vaulable - Closs Vauiable are qhbal
to a elass and. belong. to the enthe sit
obËect that are
declaxed foside the class
ocal Variables -kocal yos1tables a8e declaxed
and use nside method .
oco becau6e hey Te
e calls d. ag
N0t avalable fon u6e outside he rnethaá.
afinttlon
Exanble Buaqsan
class abc
iot b =l0:Anstance vaiaple
þublic static vaid. main (Strina, tloys
int b= 20; ocal vasuiable
Syetem.out sbainn. (6)F
2
3
0UTPUY- 20
-tybe
Nideninge
uteint - {loat - double
Nasawg nt as
Examble : float
b=aj
yhes infolaut
g Iava
oßexations Ndeiablse
there
teon toused. is' that Symbal
sa ianibulations
manißulationa
ObErab
az logical
l ma
cesttaln seform toCombut e
isthatsunbal oþerator
an is An
Exbresstana. Oberatars
strina char double flohorlonq
at b
nt
Class Baolean. Chasactex foint loating siteqe
detved) Non-Nåmeric Numgric
-däelined (User
tive. Non- Fundamental) (Bte-defineda
fotimitive
he Dato
Daba
Cbgte) n=byteThes
datatybe) 50m= ntExamle
vauiablename.
Cast((
tng=1 The datatube
Natoung
JtAGE
LATE
Vauigble
ohenataes,
AncTement Oherator (t)
DecTement Ohesator (5
Class Test
bublc static void main CSuing ay
int = 20j
Sustem.sout þsint zt+);
Sustem out baintln(tt*);
Sustem.out 7rintn. (z--);
System Qut kainth (--);
QUTPUT- 20
20
closs Demo
Bhikt Obexator
Oberato This
shift al bits in a obexator is used to
value' to he at night
gide' of a shecified numbes.
shi4t Obesato are tyo
folt shit Ohestator tybes
class KaktShift
bublic st atic void. main (3tring
Sustem.0ut print 10<2); Tot2^2 agscDE
- 1o*4 40
Siystem Quta þrinttn Clo <<3); /1o*2^a 80
closs
Rigbt shift
þublto static void man (string. asgs EI
System Quto brint (io 2) /1o/202 =2
SystemQJt pnintin. (20)3); /20/2ng = 2
Dystem Dut iprintln (80»4); W80/24 - 5
4) Relattonal Ohaxata4
OhEatos Lxaahle a=10,
Equal to (-) (a=b) is false
Nátequal to (!-) (a<-b) is true
peates than. () (a>b) s fols e
Lessthan (<) (a<b) strue
Gxeater han. equata (a=6)
is not tuue
ÅLSS than equal to a< =b) is true
IF Stotement
class If Test
public static void main (string
int i, count, coun t 1 ocount2;
float CJ
C] weight 45-91
45:0 55-0F
40F , 51·0F 54F?.
float CJ height i 176:5 f, 144:2F , 16hre
140-4E »l69.0F?:
Count =0;
CONt 2=0;
fos Ci- 0; ie= 4; itt)
i{{ (weig ht Ci] < 50-0 &B& helert
C100)
count 1 = count 2t1:
CQunt Countt1
cOunt 2= count
Sus tem s Qut "þrîntln ("No:of
66
berson
Systenn-out frintla. wight <50 &
6eiaht a(0 tout
Systern:Out println ( otthesg-"t cauna
IF ELSEShotemeot
Bubl'c class student
public statle void main (Strinq. avqs)
nt
nt s 12;
ty<lo)
System"
else outfrintln.ty
ahan 1o"»: ts less
Systemsout brintln 66
dhan 2o *);
IF ELSE IF
Statenment
Bublic. elass Student
tubllc static void main
(Stsitng C augs
Strigg cty 6 Meenut
Delhi
9)
99
2 Sysim:out:haintn ( city );
Nested- 1 Statement -
bublec. elass Student
ublic stakic uaid main (String CI aqs)
Stnin addue ss Delhi sndia. 3
System
break out rintin (* ");
Case1
detautt4
System sout sbrtntin.Cnun);
2
FOR
public class CalCulation
butlic static void man (string augs C1)
int sum = 0
for (int i = 1 f<= 103jtt)
Sum Sum t
System outþ1intln ( Sun. of ftsst io
notuo aL num o
fon=each laah
Syntax
or(data-tyhe. va4 ii aNHay- name(collectl'
name
bn.
Statement
hublicclass Calculattan
fublle stotio void. main (Strinq auqs c)
L] names =
66 C++ 99
tava , 66°c,
99
Python
JavaScribt "'3
Sustemout þrintle (°Printin
Content l2 ) 99
the
fog (stzing name names)
System -outsprin.tte (name);
while Zoas
class Calculat'on
bublie static void matn
int (Strlng C) augs)
Syst em Qut
ohile. CiK-1)þaintln
SystemaQutþxinttn (i);
Do- ahile onß
class Calculation
bubl'o static void. main.
(string
System 0utobrinttn (o(ist of10 no. 2;
Ssstem.Out
t2
prontin Ci),
while ik =lo);
Uumh sBatements
Beak.
2) Continue
System outehrintln.C);
$
3
2) ublic class Continue
S
4)