最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么代碼和老師的一樣,卻輸不出數(shù)據(jù),只能輸出 System.out.println("有參輸出方法");的內(nèi)容

package muKe;

import muKe.Computer;

????public class NewComputer {

????public static void main(String[] args) {

????// TODO 自動(dòng)生成的方法存根

????Computer way=new Computer();

????Computer way2=new Computer(15.1f,2.3f,6.3f,2.6f);

}

}


正在回答

5 回答

loat room; 應(yīng)該是float room; ?還有就是System.out.println("有參輸出方法");改為System.out.println("有參輸出方法"+screen+cpu+mem+room); ? 這樣就可以輸出參數(shù)值了。

0 回復(fù) 有任何疑惑可以回復(fù)我~

樓上讓我豁然開朗啊,懵逼了

0 回復(fù) 有任何疑惑可以回復(fù)我~

你的有參的構(gòu)造方法并沒(méi)有輸出成員變量的值,構(gòu)造方法只是給成員變量賦值的,用System.out.println();輸出一下

1 回復(fù) 有任何疑惑可以回復(fù)我~

package muKe;

????public class Computer {

????????float screen;

????????float cpu;

????????float mem;

????????loat room;

????public Computer(){

????//無(wú)參數(shù)輸出

????System.out.println("無(wú)參輸出");

}

????public Computer(float newScreen,float newCpu,float newMem,float newRoom){

????????screen=newScreen;

????????cpu=newCpu;

????????mem=newMem;

????????room=newRoom;

????System.out.println("有參輸出方法");

}

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

把你的有參的構(gòu)造方法貼出來(lái)唄

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么代碼和老師的一樣,卻輸不出數(shù)據(jù),只能輸出 System.out.println("有參輸出方法");的內(nèi)容

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)