Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7649990
  • 博文数量: 961
  • 博客积分: 15795
  • 博客等级: 上将
  • 技术积分: 16612
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 14:23
文章分类

全部博文(961)

文章存档

2016年(1)

2015年(61)

2014年(41)

2013年(51)

2012年(235)

2011年(391)

2010年(181)

分类: Java

2012-04-09 20:56:19


点击(此处)折叠或打开

  1. public class Test {
  2.     void max(int a , int b) {
  3.         System.out.println( a > b ? a : b );
  4.     }
  5.     
  6.     void max(short a , short b) {
  7.         System.out.println("short");
  8.         System.out.println( a > b ? a : b );
  9.     }
  10.     
  11.     void max(float a, float b) {
  12.         System.out.println( a > b ? a : b );
  13.     }
  14.     
  15.     public static void main(String[] args) {
  16.         Test t = new Test();
  17.         t.max(3, 4);
  18.         short a = 3;
  19.         short b = 4;
  20.         t.max(a, b);
  21.     }
  22. }
课件: 方法重载.pdf   
阅读(838) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~