class A
{
public void fun()
{
    System.out.println("void ");
}
public int fun()
{
return 3;
}
public static void main(String args[])
{
new A().fun();
}
}

解决方案 »

  1.   

    嗯  补充一点,参数顺序也可以不同
    class ABC
    {
        public int fun(int a, double b)
        {
            return 2;    
        }
        public int fun(double a, int b)
        {
            return 3;
        }
        public static void main(String args[])
        {
            new ABC().fun(2, 2.0);
        }
    }
      

  2.   

    这样递归的问下去永远没有结束.
    要学java,找本基本的书,比如Core Java,把书上的内容先弄懂.
    然后有什么问题再拿出来讨论,那样更有效率.
      

  3.   

    方法重载与返回值无关,它只和方法名、参数类型、参数个数有关,
      这些基本的java知识,如果有时间,建议大家可以多看看java基本知识,
    对我们大家都很有帮助,特别是在很多设计的时候