0% found this document useful (0 votes)
32 views

Java Handwritten

The document discusses different types of tokens in the Java programming language including keywords, identifiers, literals, operators and variables. It provides details on each token type, their syntax and usage. The different token types are the basic building blocks that make up the Java language.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Java Handwritten

The document discusses different types of tokens in the Java programming language including keywords, identifiers, literals, operators and variables. It provides details on each token type, their syntax and usage. The different token types are the basic building blocks that make up the Java language.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

ituh a Eoviuonment auioble.

:
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.

Keywords- Keywasds imblement


M nganqe. 4aVa lang uage Shece
has AeSced
"50 keuards snce Reyiwes ds have sht
Reyiwes ds
mealing in ava we connot use. dhem as
Nams aforvautabe classes,mthads go q
JAG0

All key wods. ce. to be


COSe letters
ava w3itten
iSS a in
louiesL
Janauage COse Snsitive
Ex AbstactEx
class, etc. tends )native , rstected,
)Identifíess They axe uSed fos
classes meaheds naain a
yautables obËects.
labels fackage andintetaaes in a
hsagsiam
Rules to be n

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

thauactcu. Set n Jaxa


Sit o7 alhhahet, ethesu , dylt and stacb
Stucil
chauacte' dhat ae valid in
Both lower case (asbscos, z) ond.
uphercase (AsB»lsb., Z).
SHecfal Chasactes
hiBe shaces space , Tab.
N) Constant -
Constant in java chonht fixed value
sualens to fed value.
ttat does Tot bt chante adurin executio.

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 .

Buakax dakatypejbe vantable.name


float 6 5"2; Wdeclorotior initialtzo

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

1 Widening. Tube Castina _boah. ata..


0m

2) lausoutng ape Castira - C0nvetime

-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

2)tithematic Ohexatoy - his ohesatox s


used to
*
opsuote
/ , %)
m.
9 9

closs Demo

fublic. statio void main (Strbg ugs


int a 20 y=l03
nt
System out fafnt ();

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

Ohsuakas Exaahle. (a is true &bis talse


fals.
(allb) is trut.
T(abe B b) is tue
dssianment
Ohexata
Example. aSsigr
Z= 2+y- dtere dhe value x+ty' inta
) Texnay
salso
Obesatoe
4t known as
This abenator consists Conditiom
and. is used.
9 al oþeratox
dtstee variablee
Eyntax boolean
DataYþe ><Vaiablename) =
<value lf rue ? <ExþessPon>
<Value If
class Test
Folse>

fublic static void man (3


int a= 2;
int b= 5,
int min = Ca<b)?ai6;
System out sfaintln. Cmin)
OUTPU-2
Contea stataments
The Control Statements ae used.to coe.
the execution

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

Systemaut printa city


else

System outfrinth ( Ctky ts Notde ;


6C
els e

2 Sysim:out:haintn ( city );

Nested- 1 Statement -
bublec. elass Student
ublic stakic uaid main (String CI aqs)
Stnin addue ss Delhi sndia. 3

RCaddse ss.en ds Wiah.Ceiyo dia


i (addueSS -COntains (ef Moesut )
G6
System soutbrintth ("Your cityMeput
îs
else f addre ss. contains (ce Notda),

System igut baintln (as hur atty i& Nolds


else

Systzm: aut þrintle. (addsess sþlt (", ")e)


2
else

Sustem "out print e You ae, ng


Swttchs
Statemunt-
public class Student
bublic static void
mai (Strinq axas lv
imtMUm 2;
Switch. num)

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

publi'c class Break


ubli skakt vald. main. (Strin aug c)2)
(nt i= 03 i<= l0j t +)

System outehrintln.C);
$

3
2) ublic class Continue
S

fublic statie waid man (Strin asgs t)


for (int i- 0; i<-23it+)

4)

Syslem aout þrihtBn Cj);

You might also like