package edu.xcdq;
/**
- @author yuhuicun
- @date 2021/4/20 14:48
*/
public class Phone {
public double width;
public double height;
public int weiht;
public String color;
/*
構(gòu)造方法 1. 一定沒(méi)有返回值 2. 方法名字必須和類名完全一致
*/
// 無(wú)參構(gòu)造方法大磺,不管寫不寫螺垢,系統(tǒng)都會(huì)生成
public Phone(){
System.out.println("被調(diào)用,有一個(gè)對(duì)象產(chǎn)生");
}
public Phone(double kuandu , double gaodu , int zhongliang , String yanse){
width = kuandu;
height = gaodu ;
weiht = zhongliang;
color = yanse;
}
public Phone (double kuandu , double gao , int zhongliang){
width = kuandu;
height = gao;
weiht = zhongliang;
}
public Phone(int kuandu , int gao , int zhongliang){
width = kuandu ;
height = gao ;
weiht = zhongliang ;
}
public void startUp(){
System.out.println("正在開(kāi)機(jī)");
}
public void suopin(){
System.out.println("手機(jī)即將鎖屏");
}
//方法的反復(fù)
public String toString(){
return"{"+ this.weiht+""+this.height+""+this.weiht+""+this.color;
}