課程
/后端開發(fā)
/Java
/Java入門第一季(IDEA工具)升級(jí)版
怎樣用鍵盤輸入為一個(gè)數(shù)組賦值和輸出?怎樣用數(shù)組去儲(chǔ)存商品的名稱和單價(jià)?
2017-05-05
源自:Java入門第一季(IDEA工具)升級(jí)版 7-1
正在回答
import java.util.Scanner;
public class HelloWorld {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? int[] scores = new int[3];?
Scanner s = new Scanner(System.in);
System.out.println("請(qǐng)輸入數(shù)組元素:");
? ? for(int i=0;i<scores.length;i++){
? ? ? scores[i] = s.nextInt();
? ? }
? ? System.out.println("你輸入的數(shù)組元素是:");
? ? System.out.println(scores[i]);
? ? }?
}
舉報(bào)
0基礎(chǔ)萌新入門第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語(yǔ)法開始
3 回答將商品的單價(jià)存入數(shù)組中
1 回答可以用數(shù)組儲(chǔ)存對(duì)象嗎?
5 回答數(shù)組存不進(jìn)去
1 回答char存儲(chǔ)的單個(gè)字符
1 回答數(shù)組不聲明個(gè)數(shù)默認(rèn)是存儲(chǔ)多少個(gè)?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-05-05
import java.util.Scanner;
public class HelloWorld {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? int[] scores = new int[3];?
Scanner s = new Scanner(System.in);
System.out.println("請(qǐng)輸入數(shù)組元素:");
? ? for(int i=0;i<scores.length;i++){
? ? ? scores[i] = s.nextInt();
? ? }
? ? System.out.println("你輸入的數(shù)組元素是:");
? ? for(int i=0;i<scores.length;i++){
? ? System.out.println(scores[i]);
? ? }
? ? }?
}