0% found this document useful (0 votes)
13 views18 pages

OOP

Asssignment

Uploaded by

saymyname.pt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views18 pages

OOP

Asssignment

Uploaded by

saymyname.pt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
Electronics and Communication Engineering Discipline Khulna University, Khulna Course Title: Object Oriented Programming Course Code: CSE-1251 Submitted To Atanu Shome Assistant Professor Computer Science and Engineering Discipline Khulna University, Khulna Submitted By ‘Md. Mahfujar Rahman Murad Student 10: 220903 1 year, 2 Term Electronics and Communication Engineering Discipline Khulna University, Khuina Date of Submission : 15" October, 2023 De a tien See a wale 0 file and write fo inrmaton Asignnser’ 1. a Yul University. packag 0 kahsk1, import java-i0- File 5 impor} java.util. FormaHder ; SKS ublic elacs "le Public ste fe void main (shing LJ args) 4 Bd t File f4=now File ("C Vee ee FT. crealeNewFile ¢) ; Termatter fn > new Formatte p es, 4 KU"); a fanat (“ashe |n’ “Here is 10 infirmalon abut hua Universi i Ly frmet ("as\r\n") "0 Khulna Unversity t 0 renowned| Wie Univer s| as public, a of ah 9 ’ e Crstelr” ie was started with 99 : students”) 5 ” "ge of w2% tt has 29 B5\vhn 5 t C 7 ck a . wits ie asics wil tm. fomat ("psirin uy. Tt has a contrad Ubmary a Am. rma ("rs\r\m M5 Tt hos dhret oeadmee. walling’). ™ hemat Crsir\n" "CTH ig sthaled boride Sher & Bangla. read} Benes C"astrin’, "9 has 9 bap postel”) ° . m- firm af ("AYo ln" "® Wy hes 2 girls’ hotek 5; yr $que and 4 1H hes a larga Mosq ormat (as\r\ry SB 4 j a ny a mat (Ashen, iy. kas 0. canta fatorator) ose ¢ Dy nae stem. cud: protln ("Mm file bs created suesahaly’); Bie ¢ ] | Asigomen} 24 Imagine File named "input: txt" eantadns Snumbers, oad thore fur numbers and maltip ly Ham together. Outpt the tesult tn another Al. poekaye kahskay Import Java: 10 Fila; \ yova: util: Seonner : ee Pa sd dweile? 5 import gevei0- boffesunider » outfere Ee import Jona iv. Filewriter » public class kGHSK pubic state void main (Shing CI orgs) 4. 4 t 7) File £1 = new File (reson fem ovement nt) Goanner 40 = new Seannan (78): + product = 7 + 7 (se. hos Next Jot () f m= $e next Int ty hs println C'’'Number se + num ) ; #- num: | a” S¢ Clos2 (); S¢item. out-printin (“The praduet is.” + product iF bulferedwWritep wre new buttereduiriter (neu Fileweiter (‘c fevers 2m/boeamen ts /atput: tr ry); we. write ("Result rs - preduct ) » wr. close (); Syttem. cut. prinHn ("Ne Ale de Gheated succay fil} j cateh { Exeephon 2 ) 5 System. out. println (29; 7 Assianmon t 3: Create tuo thread. First oF be used fr prinhing numbers 1 f 100000.Second one will bo uted fr printing my mane 100000 hine)s Gh mm such @ way fnaf seeond thread - ... Btn frst. package kahs key publie class kGHSK3} public static void main (String CI ores) Thread num = new Thread (O->4 tov (int m=1 5 m <2]00000; met) Fh syttem out print n (Uhlumber :" tm); 5); mame Thread name = new Thread ot fr (int maa, m<= 100000; m+t) Sytem out-printn ("Murad") 5 93 name. sof Priveity (Thread. max. PRI0RIT name. start () ; hum. start (95 ary 4 name. 7oin() ; Sytem out. pemd(n CAoo tread Ainisha firs) ; num: jon () 5 System. out priatln ("Number Hhroad Anis hel) ; featch ( Geaption ©) { splen at pridln (6) Astignmenl 4! Ghd example. 0 . in $00 Ufferent way! (Thread elas an runnab le, inter fee), Thread class Package kghsk4; Cass Mano. extends Thread 4 puble void ran t) fp (Gr m=. nN 2am 5 mrt) 4 Syitem- out. prind/n (Murad 4; Jeateh (Ceeeption e)i Sytem aut. prin tly); ii) Cass Number extend ast a public oid run() ] ny I fe (ht mat, meg Art )I Sytem out print (ember +” rm) f peateh (Getting. 4 54am -out. print fn @); 1) public class kes kat public sfihe vid main (string £3 arys) 4 Thread Number Thread = new Numbe ro; Thread Name thread — new Name O; numbeyY Thread, start () ; namethread. 54anq- ty) 3 3 me 4 , Package kahsks; bss Name imploments Runnable, 4 try} for (int mat; m=95 m+t) } Sqltem.out print|n (“Mura d as feateh (Cceaphin ey Jystem.out: printn (2) class Namben cmplaments Runnable | public void nancy ‘at hr (int met; M25; mit) } “Syttem cut. printly (Namber: “em; | ae sytem ect prietl (a) 5 a public elas kG HSKSY public State void maim (sting lI args) 4 Runnable num - new Number ¢) + Runnable name = now Wame ¢) ; Tread numberThread = new Thread (num) ‘ Thread namethread = ned) Tread (rame) ; number Thread» sdart (a § name Thread. stant ey; ; 3

You might also like