這篇文章給大家分享的是有關java中【...】指的是什么意思的內容。小編覺得挺實用的,因此分享給大家做個參考。一起跟隨小編過來看看吧。
...表示可變長參數,就是說這個位置可以傳入任意個該類型參數,簡單來說就是個數組。
代碼示例:
1. testPoints(7);
2. testPoints(7,9,11);
3. testPoints(new Integer[]{7,9,11});
1. public static void testPoints(Integer... itgr){
2. if(itgr.length==0){
3. System.out.println("沒有Integer參數傳入!");
4. }else if(itgr.length==1){
5. System.out.println("1個Integer參數傳入!");
6. }else{
7. System.out.println("the input string is-->");
8. for(int i=0;i<itgr.length;i++){
9. System.out.println("第"+(i+1)+"個Integer參數是"+itgr[i]+";");
1.1個Integer參數傳入!
2.the input string is-->
3.第1個Integer參數是7;
4.第2個Integer參數是9;
5.第3個Integer參數是11;
6.the input string is-->
7.第1個Integer參數是7;
8.第2個Integer參數是9;
9.第3個Integer參數是11;感謝各位的閱讀!關于java中【...】指的是什么意思就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。