IT 168 Lecture Notes - Lecture 5: For Loop
Document Summary
I(cid:374)stru(cid:272)tor tea(cid:272)her = (cid:374)e(cid:449) i(cid:374)stru(cid:272)tor (cid:894)(cid:862) (cid:373)ith(cid:863),(cid:863)a(cid:374)(cid:374)e(cid:863), (cid:862) tv(cid:1005)(cid:1004)5(cid:863)(cid:895); ---- use for car tester ?-| ^^^^^^- (cid:272)reated (cid:862)s(cid:373)ith(cid:863) (cid:862)a(cid:374)(cid:374)e(cid:863) (cid:862) tv(cid:1005)(cid:1004)(cid:1009)(cid:863)------ teacher/ assigned this to reference name | ^^^^^^- (cid:272)reated (cid:862)ja(cid:374)e(cid:863) (cid:862)sa(cid:448)it(cid:272)h(cid:863) (cid:862)pearso(cid:374)(cid:863) ------- book- assigned this to reference name. If you just put course without to. string it wil default to calling to string. Put name of reference object (course) will call to string from course. If want to display textbook for the class. o. p(cid:894)(cid:272)ourse. gette(cid:454)t(cid:271)ook. to tri(cid:374)g(cid:894)(cid:895)(cid:895); (cid:455)ou (cid:272)a(cid:374) (cid:272)all to stri(cid:374)g (cid:271)ut do(cid:374)"t (cid:374)eed to. The get te(cid:454)t(cid:271)ook will return the object of textbook. (book). s. o. p(course. gettextbook(). getpublisher()); s v main( Thro(cid:449)s(cid:894) (cid:449)e do(cid:374)"t do the thro(cid:449)s here (cid:449)he(cid:374) doi(cid:374)g i(cid:374)put a(cid:374)d output files. The try block, this is where you put statements that could raise exceptions. Try rest of code aftet try catch block do not put code in try block. Catch(filenotfoundexception e(e is built for you as default?) s. o. pl(cid:374)(cid:894)(cid:862)file not fou(cid:374)d(cid:863)(cid:895); make sure you put what file caused the problem.