為什么最后還要+three?
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 =one +two==>"+three);
??????? three += one ;
??????? System.out.println("three += one ==>"+three);
??????? three -= one;
??????? System.out.println("three -=one ==>"+three);
??????? three *= one;
??????? System.out.println("three *=one ==>"+three);
??????? three /=one;
??????? System.out.println("three =one ==>"+three);
2020-05-28
表示字符串和變量的拼接
2020-02-17
雙引號(hào)里面的內(nèi)容是直接原樣輸出的,后面的three代表變量three的值,加號(hào)是連接兩個(gè)字符串用的。
例如:System.out.println("three =one +two==>"+three);中引號(hào)內(nèi)的three =one +two==>照樣輸出但是沒有值,所以要添上+three將變量three的值也輸出來。