<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Java——可變參數

      package com.demo.day;
      /*
      java 允許將同一個類中多個同名同功能 但 參數個數不同的方法,封裝成一個方法,就可以通過可變參數實現
       */
      public class Varparameter {
          public static void main(String[] args) {
              HspMethod m = new HspMethod();
              System.out.println(m.sum(1,4,3,2,4,53,34));
          }
      }
      class HspMethod{
          public int sum(int n1,int n2){
              return n1 + n2;
          }
          public int sum(int n1,int n2,int n3){
              return n1 + n2 + n3;
          }
          public int sum(int n1,int n2,int n3,int n4){
              return n1 + n2 + n3 + n4;
          }
          //int... 表示接受的是可變參數,類型是int,即可以接收多個int(0~n)
          //使用可變參數時,可以當作數組來使用,即nums可以當作數組
          //遍歷 nums 求和即可
          public int sum(int... nums){
      //        System.out.println("接收的參數個數=" + nums.length);
              int res = 0;
              for (int i = 0;i < nums.length;i++){
                  res += nums[i];
              }
              return res;
          }
          //可變參數可以和普通類型的參數一起放在形參列表,但必須保證可變參數是在最后
          //一個形參列表中只能有一個可變參數
          public void f2(String str,double... nums){
      
          }
      }
      
      

      image-20230513210822639

      package com.demo.day;
      
      import java.util.Scanner;
      
      public class VarParameterExercise {
          public static void main(String[] args) {
              YshMethod ysh = new YshMethod();
              Scanner sc = new Scanner(System.in);
              System.out.println(ysh.showScore("游書恒",78.5,99,56,56,45,34,65,34,88));
          }
      }
      class YshMethod {
          public String showScore(String name,double score1,double score2){
              double res = score1 + score2;
              return "姓名:" + name + "\n兩門總分:" + res;
          }
          public String showScore(String name,double score1,double score2,double score3){
              double res = score1 + score2 + score3;
              return "姓名:" + name + "\n三門總分:" + res;
          }
          public String showScore(String name,double score1,double score2,double score3,double score4,double score5){
              double res = score1 + score2 + score3 + score4 + score5;
              return "姓名:" + name + "\n五門總分:" + res;
          }
      
          public String showScore(String name,double... scores){
              double res = 0;
              int num = 0;
              for (int i = 0;i<scores.length;i++){
                  res += scores[i];
                  num++;
              }
              return "姓名:" + name + "\n" + num + "門總分:" + res;
          }
      }
      
      
      posted @ 2023-05-16 00:53  Hello_world_名字被取了  Views(42)  Comments(0)    收藏  舉報
      主站蜘蛛池模板: 中文字幕日韩区二区三区| 国内精品免费久久久久电影院97| 久久综合久中文字幕青草 | 日韩精品理论片一区二区| 武隆县| 精品国产成人亚洲午夜福利| 东方四虎在线观看av| 东方av四虎在线观看| 亚洲午夜伦费影视在线观看| 国产在线超清日本一本| 你懂的在线视频一区二区| 国产美女久久久亚洲综合| 亚洲男人天堂2018| 摸丰满大乳奶水www免费| 视频一区视频二区视频三| 亚洲 日本 欧洲 欧美 视频 | 亚洲中文一区二区av| 亚洲精品第一区二区三区| 蜜臀久久99精品久久久久久| 成人性做爰aaa片免费看| 在线观看免费人成视频色| 元朗区| 国产精品剧情亚洲二区| 国内精品久久久久影视| 久久精品人人槡人妻人人玩AV | 亚洲色婷婷一区二区三区| 国产人妻精品一区二区三区不卡| 午夜福利你懂的在线观看| 国产精品久久蜜臀av| 中文字幕日韩有码av| 美女人妻激情乱人伦| 大伊香蕉在线精品视频75| 五月婷婷中文字幕| 成全世界免费高清观看| 成人午夜福利精品一区二区| 国产av一区二区不卡| 噜噜久久噜噜久久鬼88| 色欲久久综合亚洲精品蜜桃| 元码人妻精品一区二区三区9| 亚洲开心婷婷中文字幕| 迁安市|