數(shù)據(jù)加載中……
          java方法的重載
          /*01*/public class calculator
          /*02*/{
          /*03*/   public int add(int a, int b)   
          /*04*/   {
          /*05*/        return a+b;
          /*06*/   }

          /*07*/   public double add(double a, double b)
          /*08*/   {
          /*09*/         return a+b;
          /*10*/   }

          /*11*/   public float add(float a, float b)
          /*12*/   {
          /*13*/         return a+b;
          /*14*/   }

          /*15*/   public static void main(String args[])
          /*16*/   {
          /*17*/          calculator cal=new calculator();
          /*18*/          int iResult=cal.add(12,13);
          /*19*/          double dResult=cal.add(12.0,13.0);
          /*20*/          float  fResult=cal.add(12.0f13.0f);
          /*21*/          System.out.println(iResult);
          /*22*/          System.out.println(dResult);
          /*23*/          System.out.println(fResult);
          /*24*/   }

          /*25*/}

          posted on 2008-10-30 14:23 郭興華 閱讀(80) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 托克托县| 隆林| 花莲市| 长海县| 卢湾区| 阿拉尔市| 清徐县| 克山县| 沿河| 旌德县| 景东| 汪清县| 靖安县| 安龙县| 亚东县| 子洲县| 武清区| 哈巴河县| 丽江市| 迭部县| 乡宁县| 天祝| 彰化市| 阿图什市| 班戈县| 广南县| 象山县| 阿克苏市| 隆安县| 木兰县| 紫阳县| 密山市| 文昌市| 邳州市| 枣阳市| 山丹县| 兴安盟| 杨浦区| 高安市| 新余市| 上杭县|