Java Assignment 1
Java Assignment 1
3
Syaler), out.printlo ("a:"ta);
Pablic elakc void main
A obË pew AC);
objdilogC)
2) No gumen corslruclo '
called
A cordudor, cith
construcho, gumen
no
i
gumen!
cless Cons&
inl ab;
ConsC)E
Syalem out-prinlh("No orunenh conh
as
b:20)
publie void display C)
tint sum
Systerf-ofprihh
Syclen.oul prinlo(sum),
class No
yoid maio
Cons CI new Cons())
3
Paramelerized condruor
Acondludor
Iructor ih
called us potameBerizel
is
e class Cons2
int
putlie, void
int sum,
displayc)¿
Sum : a 4b
Syalen.out-prinl sam);
class PorcCons:
pablic dake oid dmain(shipg oyl])
Cons CI= new ConsC\o ,20);
Cons c2 =new Cons C30,40);
cl-displaC;
C2.displayc);
pot labilBy ath'repect
Paloro indepeodence':
JTo javo, you can. arle gompl e
then your
you
progtam
co
machine Ceg.coindow)
cormoiino))
in the Celoss le) on
or Mac0s).
other machine Ceglinux
2Thl is ohd Athe pellencorilen
indapegderconpile
Means in java .program
4
class Cmd
4) o
relurn capocily o veclor
Vcapaiky);
sJ lastelement(J
rekurn ladt elemen!
buller
bulWer
clasr jor
is C
shigg buler, is, o
pee los o shg
is Kred 2J
Linnutable] Croutable]
Con be 2J Obieds can be
Çrecoted
shing cono creok2d by coi
Construcor
ensed in double shing buller class
quoBes. ne'