public class HelloWorld{?????? public static void main(String[] args) {??????? int one = 10 ;??????? int two = 20 ;??????? int three;???????? three = one+two;??????? System.out.println("three"+"="+three);???????? three += one;??????? System.out.println("three"+"="+three);???????? three -=one;??????? System.out.println("three"+"="+three);???????? three *= one;??????? System.out.println("three"+"="+three);???????? three /=one;??????? System.out.println("three"+"="+three);???????? three %= one;??????? System.out.println("three"+"="+three? ); ?????? ??????? ??? ??? ?}}
1 回答
已采納

小羊羊ly
TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超0個(gè)贊
定義一個(gè)靜態(tài)方法output,參數(shù)類型為int,方法體中是輸出語句,輸出語句參數(shù)即output方法的參數(shù)。這樣就只用寫一次System.out.print方法,需要輸出時(shí)調(diào)用output()方法即可
添加回答
舉報(bào)
0/150
提交
取消