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貢獻2條經驗 獲得超0個贊
定義一個靜態方法output,參數類型為int,方法體中是輸出語句,輸出語句參數即output方法的參數。這樣就只用寫一次System.out.print方法,需要輸出時調用output()方法即可
添加回答
舉報
0/150
提交
取消