1 ImportJava.util.Date;//Importing Packages2 Public classTest11 {3 Public Static voidmain (String [] args) {4Catfather growup=NewCatfather ();//Creating Objects5Growup.biger (35);//Calling Methods6Growup.inlove (35);7Baddog fight=NewBaddog ();8 fight.fight ();9Boss fight2 =NewBoss ();Ten fight2.fight1 (); One A } - } - Abstract classriverside{//Abstract Parent Class theString name;//Abstract Properties - String style; - intAge ; - String Skills; + } - classCatfatherextendsriverside{//Inheritance +String name = "Yang Kang"; AString style = "caption"; at intAge = 0; -String action = "Eat, sleep, play peas, drink water, play, learn!" "; -String skills = "Sunflower treasure, nine Yang Martial, the universe big Luo move." "; - Longy=NewDate (). GetTime ();//New Object Call method -Date time=NewDate (y);//Building Objects - in - floatweight; to voidBiger (intN) {//Growth Stage + inti; - for(i=0;i<=n;i++) {//changes in weight during growth the { * if(n<=20){ $System.out.println ("Yang Kang has not grown up, is working hard to learn skills!" ");Panax Notoginseng Break; - } the if(n>=100){ +System.out.println ("Yang Kang is dead! "); A Break; the } + if(i==0){ -Weight = 3.8f; $System.out.print (time+ "A black kitten was born, heavy" +weight+ "kg. The name "+" is called "+name+". "); $ } - Else if(I>0 && i<=20){ - Doublej = 2.5; theWeight + =J; - }Wuyi Else if(i<25){ the Doublej=2; -Weight + =J; Wu } - } About $}system.out.println (20+ "Years later," +name+ "Every Day" +action+ "grow to" +weight+ "kg, learned" +skills); - } - voidInlove (intN) {//Love Phase - for(inti=0;i<=n;i++){ A if(n<=30){ +System.out.println ("Kitty hasn't found a girlfriend yet!")); the Break; - } $ if(n>=200){ theSystem.out.println ("The Kitten is Dead!")); the Break; the } the -}system.out.println (name+ "and Mullianz love, and have a child, named Yang, Yang Kang put his magic to Yang. "); in } the the } About classBaddogextendsriverside{//Inheritance theString name = "Ouyang Fung"; theString style= "Teddy"; the intAge = 3; +String skills = "Seven wounds fist, mixed Yuan bang hand, evil spirits sword." "; - voidfight () { theSystem.out.println ("Wang Chongyang's family also has a person named" +name+ ", he will" +skills);BayiSystem.out.println ("One day they fight up," +name+ "used the" +skills+ "Yang Kang used the sunflower treasure, nine Yang, the universe big Luo move. "); theSystem.out.println ("Time Swords, cat fist dog leg, broke the glass, messed up the room."); the } - - } the classBossextendsriverside{//Inheritance theString name = "Wang Chongyang"; theString style = "All true teachings"; the intAge = 30; -String skills = "Flirt Sword, Amorous sword"; the voidfight1 () { theSystem.out.println (age+ "old" +style+ "" +name+ "to see after very angry, use" +skills+ "to the Yang Kang and Ouyang Fung into serious injury, put Ouyang Fung life imprisonment, and put Yang Kang drive out! ");
System.out.println ("A year later Yang Kang depressed to death. Ten years later, Yang and her mother are starving too! ");
94 }
Import java.util.date;//Importing Package public class Test11 {public static void main (String [] args) {catfather growup=new catfather (); Create Object Growup.biger (35);//Call Method Growup.inlove (35); Baddog fight= new Baddog (); Fight.fight (); Boss Fight2 = new boss (); fight2.fight1 ();}} Abstract class riverside{//Abstraction parent String name;//Abstract property string Style;int age; String Skills;} Class Catfather extends riverside{//inherits string name = "Yang Kang"; String style = "caption"; int age = 0; String action = "Eat, sleep, play peas, drink water, play, learn!" "; String skills = "Sunflower treasure, nine Yang Martial, the universe big Luo move." A long y= new date (). GetTime ();//New Object Call method date Time=new date (y);//Build Object float weight;void biger (int n) {//growth stage int i;for (i=0; i<=n;i++) {//weight change during growth {if (n<=20) {System.out.println ("Yang Kang is not grown yet, is working hard to learn skills! "); break;} if (n>=100) {System.out.println ("Yang Kang is dead! "); break;} if (i==0) {weight = 3.8f; System.out.print (time+ "A black kitten was born, heavy" +weight+ "kg. The name "+" is called "+name+". ");} else if (i>0 && i<=20) {Double j = 2.5;weight +=j;} else if (i<25) {double j=2;weight +=j;}}} System.out.println (20+ "Years later," +name+ "Every Day" +action+ "longTo "+weight+" kg, learned "+skills";} void Inlove (int n) {//Love stage for (int i=0;i<=n;i++) {if (n<=30) {System.out.println ("Kitten has not found a girlfriend!"); break;} if (n>=200) {System.out.println ("Kitten is dead!"); Break;}} System.out.println (name+ "and Mullianz love, and have a child, named Yang, Yang Kang put his magic to Yang. ");}} Class Baddog extends riverside{//inherits string name = "Ouyang Fung"; String style= "Teddy"; int age = 3; String skills = "Seven wounds fist, mixed Yuan bang hand, evil spirits sword." void Fight () {System.out.println ("Wang Chongyang's family also has a person named" +name+ ", he will" +skills); System.out.println ("One day they fight up," +name+ "used the" +skills+ "Yang Kang used the sunflower treasure, nine Yang, the universe big Luo move. "); System.out.println ("Time Swords, cat fist dog leg, broke the glass, messed up the room.");}} Class Boss extends riverside{//inherits string name = "King Chongyang"; String style = "full true teach"; int age = 30; String skills = "Flirt Sword, affectionate knife", void fight1 () {System.out.println (age+ "Years" +style+ "+name+" is angry after seeing, use "+skills+" Put Yang Kang and Ouyang Fung into serious, put Ouyang Fung life imprisonment, and Yang Kang out! \ Yang Kang depressed to death a year later. Ten years later, Yang and her mother are starving too! ");}}
Little Java Story (i)