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