Comment on Tutorial - Method Overloading sample in Java By Ganesh Iyer



Comment Added by : Gaurav

Comment Added at : 2013-07-28 15:53:20

Comment on Tutorial : Method Overloading sample in Java By Ganesh Iyer
You can not overload the private method in Test class.
there is no problem with protected method.
check out this and try to run

public class A
{
int aa,bb,addd,pp,qq,rr,add2,ss,tt,uu,vv,add3;
void overload(int a,int b)//===========1
{
aa=a;
bb=b;
addd=aa+bb;
System.out.println("Addition is="+addd);
}
private void overload(int p,int q,int r)//============2
{
pp=p;
qq=q;
rr=r;
add2=pp+qq+rr;
System.out.println("Addition is="+add2);
}
protected void overload(int s,int t,int u,int v)//========3
{
ss=s;
tt=t;
uu=u;
vv=v;

add3=ss+tt+uu+vv;
System.out.println("Addition is="+add3);
}
}



class test
{
public static void main(String a[])
{
A a1=new A();
a1.overload(23,55);
A a2=new A();
a2.overload(20,40,60);
A a3=new A();
a3.overload(20,40,6,100);



}
}

if not getting debug then try to make private method as public and check out,,,,,,,,,,,,,,
Thanks


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. pls give us aprogram of postfix and infix using st
View Tutorial          By: lost_hope1111 at 2009-02-13 01:48:37

2. Your explanation is good but, it will be better i
View Tutorial          By: Jabaraj at 2010-03-22 06:02:33

3. good one
View Tutorial          By: yogesh at 2010-07-24 21:18:24

4. Hi Dear All

How to do strike-out in

View Tutorial          By: Sandeep Mehta at 2012-11-21 06:54:06

5. thanks excellent explanation!!!!!!!!
View Tutorial          By: divya at 2012-01-01 17:37:32

6. hi,
my problem is.......
i use vb.ne

View Tutorial          By: Anirban at 2009-10-25 10:15:13

7. Hi, thanks for your code, I have modified a little
View Tutorial          By: Armando at 2010-08-10 09:34:35

8. good
View Tutorial          By: osman at 2011-11-21 22:23:02

9. dear! can you show me about "How to start as
View Tutorial          By: vatha chhean at 2011-05-31 07:34:42

10. Awesome information
View Tutorial          By: Pavan Somu @ Tech Tips at 2013-01-03 18:45:30