Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Rol No:SEConmf B1o

Page No.
Date
CPPLO

P RELIM EXAM

-3-
aCla5s Kaam

nt omNa
StyinqoomIypc
tLoatToamAca
boalean_ acMachinc

Void 5.et Dato Cimt n o 5tiinqtflo.dt axcd


b0olcaLn a c )

OomNo Yno
A0bmLupe t
oom AÝeo ax.ea
acMachine_ac
od di5plauData O

Sust.em Out print]n Thc Yoom JS+


m No)
oustenm: dutpriniln(TheNOAm upe is
T0oHTYPC
Sustcm outpTintn Tbe o.om drca is"-
1 mAYeo)
Stxin 5 acMachinc)"
qsn
5uste.m0ut printIn The Ac Machinc
Tecdtd"t5),
Paga No.
Date.

public 5tatic aid main5txina ax-t

RoomT m1 mt-wR0.m
Oam 1 5et Da to Lio Deluxc",2.
True ,
Taam 1 display Daia

bclaSs MyExcepsian etcnds Exception

publicMyEzcepiian 6txing 5)
SuperL5)

pubic class Main


public static Voi.d mainstinq axq5C

Thuwmcw MyEzception "Welcome

catch MutxLcptisn c ) s
SustcmOutpintln(" causht)
Susitmout Pintln (eqet mc.shcqt
Page No.
Date.

c) Mutithae.adinq

OMultithx.ca.dimq miava is op.o.cc.ss0T


xecuim tuuo ox maxe Abxe.cds Simultandoust
tomaximum utilizatin.n at cPy
Mullithy.ead.cd arp execut.c wo o aoY
thxe.dd5 u n concrentls
n
Hencet is alsa Kmoum as comcuyx.ent

av.c

Each thxead uns p.axalleto each othex


MulHiplc thxc.ad5dom'allo.c.atc Sep.ax.atc
memonuAxtahence theu Save mcmar
Also ontci gitchimq be hieadstake
less timc

NCcd of mulAithae.adinst

ORsLwC know thot nutltithr e adindpravide


Simultdne.a.usicccuti.on of twoo pcr ts of
dPio.qadmto mc2imum utilizati.om of
cPU time Duc to uhich Aheidle tinme
Cam be kept minimum

Multithreadind p1ovides espon.sivemc5s


fox thnc pio.qYcm s Luei dS e Souxce
Shaxind is 0mct the iqniti cdmt feature

11 savides bettea 5cala bili ty clnd


Mminimized 9usiem csaulce Sciqe
Hence, it 5 much mc eded PT o cess
PageNo
Date

txample of mul4ithXeading

packaaedemotcst
public cla5s RIhxtod 1
implemens Runna blc

public Static yac


main L Stxinq C aqs
Thxt.ad RThxcnd 1 DCw

Thicad RIhxecuc 2 nc.


1bxead (R
RThread 1 Staxt
RIhread2 ShaA

Sustem oLtprintln head namc5 ca


fonauim3

Sustemout print ln B Thiead 4:aetNamc }

Sushem ou xintln CRthit.ad 2aet Name t3);


NeIide
publicNoid xun ( s
PageNo
Date

5.et Valut1 to 3a
Set value to 15
CSetaVall
3o)
CsetNal2 15)

ddidiom apexatism
Lpxint(tNali1 val)

Subtxaction opexdtion
tpxint a 4 Nal 2)

muttiplicationope.ation
print Nal 4 Nal2)
diiisib nopexdtiom
pint Nal4 vdl)

modu lus apexatioxa


Cpint MAD Val Va )

incxe ment a b Ip
CpxinCine Nali Nal)
decaem.ent b bt
CpintLdect Val 4V.ct)
10mp.axtia Yatil 5.ca.nncs

class Axec

doubl.c anco-
AxC.a Celouble)

axca )7

classxcurmica
publicGtdtic Noid m.ain StT.a acs ]l

Scanncx 5 mc 5canncY Sust.emjn)


Sustem:Autpaintln Entc the iadius
doubl.e ad 5mcDaublcO
Aaea e w Ared (adS
Sust.emOutprint Axea af cixce is

You might also like