You are on page 1of 8
Java Programming (22, Practical No. 17; Dey is Mm. NW Vi Vil. ‘clop a program which implements the concept of Practical Signitieane Method overr i Sverriding is used to change defin f method in subclass. C 2 ‘ 8 is used to change det cl subclass. Runtime Polymorphism is fetaiiGcerieseae ; a a achieved through Method Overriding, super keyword is used to call © parent class method or constrictor Relevant Program Outeome 8 (POs © Bas pads wwledge of basic maihematics, sciences and basic ins. solve the computer group related problem: Discipline knowledge: Apply Computer Programming knowledge to solve the computer group related problems, Experiments and y results to solve the tice: Plan to perform experiments and practices to use the computer group related problems. Apply relevant Computer pro; standing of the limitations. dual and team worl k: Function effectively as a leader and team member in diverse/niultidiseiplinary team ¢ Communication: Communicate effe Engineering too tools with an under e Ind nming, technologies and vvely in oral and written form, Competency and Practical skills “Develop Applications using Java. The practical is expected to develop the following skills: 1. Develop a program using super and sub class to override the methods. 2. Develop a program using super keyword to override the methods to achieve the runtime polymorphism. Relevant Course Outcome(s) ly concept of inheritance for code reusability. Practical Outcome (PrOs) Develop a program which implements the concept of overriding Relevant Affective domain related Outcome(s) 1. Follow Safety Practices 2. Practice good housekeeping 3. Demonstrate Working as a leader/a team member. Follow ethical practices. S Minimum Theoretical Background Method Overriding in Java , : Declaring a method in a subclass (child class) which is already existing in the parent Jass refers to method overtiding in java. he exact implementation in the subclass (child class) overrides (replaces) the mmplementation in the superclass by providing a method that has same name, same soe meters or sivnature and same return type as that of method in the super(parent) parameters or si class. Tara State Board of Technical Education a © scanned with OKEN Scanner parent Class “Overriden method Fates | ante? ‘ | eatewtatet) * : | extends |___———» sub Cinss 8 : — i Gverriding method al eg ing metiod displ | addition) Vi. Resources required (Additional) Nil IX. Resources used (Additional) [ Name of Broad Specification | Quantity | Remarks (if any) aesouse_| = y 1 itel Comer 23 | Compotey picclews (1 : * | Sobturore | jotetig, TOK | | Yes Program Code: Teacher must assign a separate program statement fo group of 4 students. Demonstrate the use of Overriding method dis} ‘Note: Attach the code at the end. Pablic Class Base 4 void isplay C) play() using Super and Sub classes i Systm.oud. Print ( Bose elas), co less Deviveol extends Bose a? ie hia State Board of Technical Edueation © scanned with OKEN Scanner a prog = pen spoil clisplayc 5 7 “super el SB faye ) Sys hem oot yy i . ys PIM ( Deve J 4 | Class OWED Fcfe ot eleuss!?)5; : Public Shes : Me Shaky ‘Voret men (shieg orgs C3) obssheo pet : 7 Ob hispleyc) abel D evivect xl. Result (Output of Code); XI. Practical Related Questions Note: Below given are few sample questions for reference. Teacher must design more such questions so as to ensure the achievement of identified CO. 1, State the difference between method overlo: nd method overriding. 2. Method Overriding is an example of. ‘Gereple-hegCompile Time Polymorphism/Run Time Polymorphism) YUOT hoe 3. Write the rules of method overriding. 4. Write the use of super keyword in method overriding. (Space for answer) Poly mer phism Ol ons _pass.....moltigh Tame.....dded.... beRPere.nk.... Pore mebyor. RnB AMM CEO Moebroud.....encermelling. happtns...then0r Maharashtra State Board of Technical Education SOT © scanned with OKEN Scanner Spc hom gles o astvcculy | dad be. GPM rreluneel. SONG a Maharashtra State Board of Technical Education | é ad © scanned with OKEN Scanner gxerelse: 1, Develop a program to overriding method, 2. Write the output of t class MyBaseC lass lisplay the rate of interest of banks by method he following: { protected void disp() System.out printin("Parent class method"); \ class MyChildClass extends MyBaseClass * publie void disp, ‘ System.out-printin("Child class method”); Public static void main (String args{]) ‘ MyChildClass obj = new MyChildClass() obj.dispQ; }} e()" method 3. Develop a program to extend ‘dog’ from ‘animal’ to override ‘move( )” using super keyword. (Space for answer) Itc... Lass... Bonks..2. au) ea deere A, fmical Eaucation Maharashtra Stare Board of Tech ee © scanned with OKEN Scanner tava Progtamimng (22412) Chess Asbo 8schemels.wBaak Tok bok 02 ohana). es) Suggestions for Further Reading, XIV, RB 1 hups: www javatpoint.com/method-overt 4 buips: NWw.tutorialspoint.comd ‘eginnersbook.conv/2014/01/method-overidingn-jav8-With-exany ey XV. Assessment Scheme Performance Indicators Process related(35 Marks) [ Eegie formation 2. | Debugging ability Follow ethical practices i Product related (15 Marks) (4 | Expected output |_5._| Timely Submission 6. ] Answer to sample questions iz Total (50 Marks) List of Students /Team Members 1 Sagi. f Marks Obtained Dated tienature of Process Product Related (35) | Related (15) —— {__ — ef Total (50) iate Hoard of Technical Education © scanned with OKEN Scanner SS Demo Whi dale ves : pod oat Veid nui Csh W221 T C2 D.C Bog oy Jew CLC] sbers.0uk pariah Ca ke of indnest of S@T——— al Doel is 44S. tobevest (105 “she cub. ankiaC Bele af jnbrat o£ BOT band je %4 by tabeves 11) 9% i a col prinkln(" abe ob jateresh of Ufc! loumk fs EL jmbeveat ¢5)5 Ss em ou. piinkln (Rube of [obevert o& Axi look fo Ma aetpberert (12) ie % clo= | Gide oP jokes} of SRT bok 1 LO. Rabe oh jotrresh of Bot Bank f 1 f Gg rs 9 | Rake of srdexest of [elcl bank oP -jnhrre public Clee Aoiorww) € ofc cogve 0) Sochien 004 print lol Agacs dey") t —Lé a Class ole catencds Anin-al —!voich ae Qs —L Super como ve (D5. © scanned with OKEN Scanner Shevdic a Lie Wid oe C8 — dog a = ews tag 0; A Tmnowe ( 2 ’ © scanned with OKEN Scanner

You might also like