Java Practice---14

Source: Internet
Author: User

1 Abstract classa{2     PrivateString name;3      PublicA (String name) {4          This. Name =name;5     }6      PublicString GetName () {7         return  This. Name;8     }9      Public Abstract voidFun ();Ten } One classBextendsa{ A      PublicB (String name) { -         Super(name); -     } the      Public voidFun () { -System.out.println (Super. GetName ()); -     } - } +  Public classL { -      Public Static voidMain (string[] args) { +         //TODO auto-generated Method Stub Ab b =NewBNULL); at B.fun (); -     } - } - Importjava.sql.Date; -  -@SuppressWarnings ("Unused") in  Public Abstract classY { -     PrivateString name; to     PrivateString Class; +     PrivateString date; -  the  PublicString GetName () { *     return  This. Name; $ }Panax Notoginseng  Public voidsetName (String name) { -      This. Name =name; the } +  PublicString getclass () { A     return  This. Class; the } +  Public voidSetClass (String Class) { -      This. Class =Class; $ } $  PublicString getDate () { -     return  This. Date; - } the  Public voidsetDate (String date) { -      This. Date =date;Wuyi } the  PublicY (String name,string class,string date) { -      This. Name =name; Wu      This. Class =Class; -      This. Date =date; About } $  PublicY () { -     Super(); - } -  A @Override +  PublicString toString () { the     return"Student [name=" + name + "]"; - } $  Public AbstractString speak (); the  the } the Importjava.sql.Date; the@SuppressWarnings ("Unused") -  Public classHextendsy{ in     PrivateString matter; the      PublicH (String name,string class,string date,string matter) { the         Super(name,class,date); About          This. Setmatter (matter); the     } the @Override the      PublicString speak () { +         return"My Name" +Super. GetName () + "this year" +Super. GetClass () + "height" +Super. GetDate () + "weight" + This. matter; -     } the      PublicString Getmatter () {Bayi         returnmatter; the     } the      Public voidSetmatter (String matter) { -          This. Matter =matter; -     } the      the } the  Public classK { the  -      Public Static voidMain (string[] args) { the         //TODO auto-generated Method Stub theY stu =NewH ("Lo Yuanhao,", "19 years old,", "173cm,", "52KG. "); the print (Stu.speak ());94     } the  the     Private Static voidprint (String speak) { the System.out.println (speak);98          About     } - 101}

Java Practice---14

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.