SoeS through Java Assiqhment
[Link]
oolahion
ot TaA
of TAVA md imporfance tompatd to tanlir
hEyplain
fe languages. Jrite
he a
Progam fo
Cmd.
Ans
.ppulor longuag inldd , (# ond tnipting lahqog3.
strenghe bt no imitafonr,
[Link] had
ie
sylem programming l(s, (ompilexs), close to hardwaye
seat uroS
lozked
bt
nanasernt (wing ree malloe)
Manual mtriong
r f ented
absractis n but still
hohdend and mple teohuos Cpointers, operators,
overloacing) otte made deve'opet hardor
ot TAVA
)Platorn indepondovme
) Aubnahi D anagemant
) Dbjet- biended
i) alh -hvoding uppoit
w) Lorge ardatd Lbraty
Progrom
class sompe
ags
publle taht void Nan (shing )
(orgs
Syokm. Oulpritn
2. Dseribe A diterent betieen JPk,
J ating
pomontote type
prg ram
a Phy
JRE
JDk JRE
tis bhe engine at n!TRE TVN +Libranies Dav tools
Tan bytecode
Tava
needed to run java
nto machne code. prograng.
Independenie developmei
Derelopeys heta'l
y Hondle Mermdry foo l
Juta le tor Tnn tng rn app
(JVM
TRE
Joval,Jag
JOk
val1 (00)
vali;
[Link] ale e
printo (u ahing
Jyctom but
al3 q4.495
double
nt valy int)yal3)
casting:
in Jaa
onstant ond datotypes"
vavables
contaiak
dsteren datatyps anol
wte A ihatyate
nane
Sores doa.
that
vobhe
A (onstan
thongod
va) name
Jinal
be ctored in Va'able.
Syntar
nt
ot types
a) Rimibve Oata tye
Byte, hort, int
b) Reterehte Pata type
yjechs.
Dronram
elats sample t
publi stahie mai (sting
short
boolean tag e;
char
dyst
system Out - pida("Short
('int:i);
lhord: 2000
boolean tue
tt opesator tova
ole
4) Diseuks he relahonat
of ar:thmeti
use
the
demongtates
on varnabes
tions
Ans
opesators in java ymbos tat pe form opera
and walues. mathemateal era tions.
operafors! peY forms
a) Authmet
too Ya bues
) Autbnal opevabrs
Cormpare
nuert co nditbn
(ombine
Program
class Somple
publ' alaie vo main (etinn anjtl1)
int a: 10 , b 2 o
ytem. Out. pvihth ("
atb
dalee
boolean Irue , y
4
Output
a+b: 8
dase
(lge
chtemens C,
(othol
byplan
to cherk whether a number
5.
provam
r l a l e m o t .
of erecuhon in
rerube prog vam hy
he lo
(ontrol
dalont
lalmept contol
Ans hal
allow eton mahin repehtion.
Stalements.
Con
di'konal
a)
block i (ondito n s re
frerule
ondih'o)
lyadat
block otstafoments
(ondihon and execulej anothot
i') -ee: erecute a
blo ck theroi'se
iHonition )
tatemel 1
etemant2
(iis) Sitra: Uoed hen Loe multiple choces tor a
vauable. syutas soikh Copato)
Cage 1.
b) tooping clateyt
(i) fur-lof Hork patcdy tor a
trecutes
statomentt
3
vepat
oWle liondhin
stks,
hd'
e, the cheeks ondtbn
epecutes atagt Oheey
do f
8tatenty
}le (tondhion,
progro
pablk stahi vod main (cting
$anne fl ne
holean isprime =tue)
is pjme - talse;
t(numyi
t s prime =false,
Out.
ese
Out put
defne a
Uni and
ks)
mav
cless objects n a m e ,
ataibutes
elau
sudente with
okjech
reate
Ans
in Java
lemptote
blue prht )and
behovisne
vaviables
(odtribuley
strutue
deflnes
intane o cass
An
every
student
obeet shul
elas desne shat
student
named
shudent
have
class
student
int id'
Sthing narme,
double yarky
Vod
Syctom. out printn (Tp:
Systom bud pintla("Name: + name)
but.
Sgs tem out pi ada/"onks: nask),
S nous
s name Wgnel"
SI mavk 60-5
output
ID: to
Wame
Viyes
Mayks:
2. Er plain tongtvucbis exampes . NP to implemant bo H
parametevid
construchr speia! metrsd in Jav a that is autorthial
an
objet is (veated.
when
Called
has Sorme name the lass and
Default (onhy co
-) A
with ho paramfe ys.
is detined iHolize obiecs
inl id
sudeut)
namt "unkmown"
studev Cint id, Shng wome) ?
his. name =nome
void dic play )
System, out. pnntln ("ip:
fublie stati void mdón sh ing
chudent 3 sludant
student sn ctudnt to,"vgna,
s2. olisflay)
mano , untnowy
Vinsh
VAv'ablo
lora!
kayod Jova
objed
claas me hod
) nvoke
rom
name
shiy
Student
[Link] name'
[Link] )
pldi etatit void mdlin
output.
nume'.
Explain mwthed loy
at
dofimnq mullipe meho1
-) Method put dtteht paranaf
hame
he
o
(omphle
loasld mahodi
alfeyenhate over
clas
vad'u)
publt doubk aea Cdouble
math P a i s odias
2eturn
ayoa(nt &de )
public int
yekun
Cint lengh, int bed4)
3
vod
tha
tiyele
pintin (" treo of squavt
'Avea o vetange ,savsc (s,1)
irelo . 35f
Araa of
Suare' 25
Are a ot
yetegla! t
Aa ot
fave. w P
coMman i'ne arguemut
short nokes on
a commdnd ino
thad
intges
to a Fava proyr
are
md Araatrats
=) (termin.
line
hen 's ^Un
tom Dmmand
un)
hing
veLieved
CH;ke int, dou be)ete
other
needed
(an be (onveyted to
)
Tntger. porse Tnf() or
wpper
Dale ).
huble pase
tiy
tlau
osgity)
vod main (thing
in nur
Sumt -num
utat
Javae Avg°emanth java
20 30
ava Avgueneub
Sum
Sort an
Ch Jqsa . JAP to
arrays
) Erplain the coneep of
n
asending orde.
element ot the same
a
tolleton D
Aray
locat'.
stoved
to sre
allus
natad
Varieby dor aA
ea h valu.
seferak
arra
de tank dom D
20,(0y
vovd main shg argsl1)
C
puble slati
Sommer CIystemi)
Gcanner S(- new
int Cn
4ray-sort aw)
(;nt
dor
Outeut
30
36 0
whal he sing aL
(bbaenat'tr kagr
.tang
Jova
is ahas
n
Ans
Jan ting
Yopretes
hiha object
Onatenatbn lomiagrfial, Srater/tatey
ctrong
Publt
Main (shiny argr(3)
puble sehe o
"Hetlo"
shing
sting ctte "wbdd'!
(" Conaikenahon
Syslem. out printa
("stl eyu als &te' st euay sh}
&ystemoub puints
Fang sen
(os))
sytem oud pontla l sen-sukstrihy
Output
4ello wbr ld
aabea
Java.