04 Definition and use of mobile phone class

Source: Internet
Author: User


Public classPhonetest {
Public static void main (string[] args) {Phone phone = new phone (); //Use member variables phone. Brand = "xm 6";phone. print = 2499;phone. Color = "Ceramic black";System. out. println ("bought a" + phone. ) Brand + ", price" + phone. Print + ", color" + phone. color); //Using member methods Phone.getcall ("lei June");phone.sendmessage (10086, "Eat dinner Together");phone.playgame ("Lei June", 1.25, "Play lol Together");    }}class Phone { //Brand String brand; //Price int print; //color String color; //How to call Public void getcall (String name) {System. Out. println ("give" + name + "Call");     } //How to send SMS Public void sendMessage (int ms, String Bean) {System. Out. println ("give" + MS + "text message, Content:" + Bean);     } //How to play the game Public void playGame (string name, double ms, string game) {System. Out. println ("with" + "+ name + " Appointment time: " + ms + ", "+ Game");     }}


04 Definition and use of mobile phone class


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.