老师,可否问您一下问题
package com.imooc; public class Initalphone { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub TelePhone phone=new TelePhone(); TelePhone phone2=new TelePhone(5.0f,1.4f,2.0f); } }
package com.imooc; public class TelePhone { float screen; float cpu; float mem; public TelePhone(){ System.out.println("无参的构造方法"); } public TelePhone(newscreen,newcpu,newmem){ screen=newScreen(); cpu=newcpu; mem=newmem; System.out.println("有参的构造方法"); } }
为什么不行呢?报错呢