亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

不分別賦值怎么輸出呢?

這個怎么輸出呢?每個“three”都不一樣的值,每次需要給賦值到一個變量中嗎?如果不賦值最后要怎樣才能把那幾個數值全部輸出呢?

正在回答

4 回答

public class HelloWorld{

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

? ?int one = 10 ;

? ? ? ? int two = 20 ;

? ? ? ? int three = 0 ;

? ? ? ? three=one+two;

? ? ? ? System.out.println(three);

? ? ? ? three+=one;

? ? ? ? System.out.println(three);

? ? ? ? three-=one;

? ? ? ? System.out.println(three);

? ? ? ? three*=one;

? ? ? ? System.out.println(three);

? ? ? ? three/=one;

? ? ? ? System.out.println(three);

? ? ? ? three%=one;

? ? ? ? System.out.println(three);

}

}

//每個“three”都不一樣的值,每次需要給賦值到一個變量中嗎?

//只有一個變量,名字叫所three。每次變化后輸出即可?。?!

1 回復 有任何疑惑可以回復我~

public class Fanch {

public static void main(String[] args){

int one=10;

int two=20;

int three=0;

int t1=three=one+two;

int t2=three+=one;

int t3=three-=one;

int t4=three*=one;

int t5=three/=one;

int t6=three%=one;

System.out.println(t1);

System.out.println(t2);

System.out.println(t3);

System.out.println(t4);

System.out.println(t5);

System.out.println(t6);

我是這樣的,也對的,但是覺得有點麻煩。還是一樓分別賦值輸出好用

0 回復 有任何疑惑可以回復我~

因為改變的就是three的值,one two是不變的,

0 回復 有任何疑惑可以回復我~

寫完一條運算,跟一條輸出語句

three = one + two;

System.out.println("one + two="+three);

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

不分別賦值怎么輸出呢?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號