Telphone类中,sendMessage方法后面括号里为什么不要写引用参数?变量在方法外,方法里要使用不要定义参数吗?
public class InitailTelphone
{
public static void main(String[] args)
{
Telphone phone=new Telphone( );
phone.screen=5.0f;
phone.cpu=1.4f;
phone.mem=2.0f;
phone.sendMessage();
}
}
public class Telphone
{
float screen;
float cpu;
float mem;
void sendMessage()
{
System.out.println("screen:"+screen+"cup:"+cup+"mem:"+mem+"Telphone有发短信的功能");
}
}