十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
...表示可變長參數(shù),就是說這個位置可以傳入任意個該類型參數(shù),簡單來說就是個數(shù)組。
(視頻教程推薦: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參數(shù)傳入!"); 4. }else if(itgr.length==1){ 5. System.out.println("1個Integer參數(shù)傳入!"); 6. }else{ 7. System.out.println("the input string is-->"); 8. for(int i=0;i3.第1個Integer參數(shù)是7; 4.第2個Integer參數(shù)是9; 5.第3個Integer參數(shù)是11; 6.the input string is--> 7.第1個Integer參數(shù)是7; 8.第2個Integer參數(shù)是9; 9.第3個Integer參數(shù)是11;
相關推薦:java入門教程
當前名稱:java中的【...】表示什么意思
鏈接分享:http://m.jiaotiyi.com/article/cheoco.html