java - Getting Error in Overloading a program -


help me in solving overloading program

public class overloading { void add() {     system.out.println("default"); } void add(int a) {     system.out.println("one int parameter passed"+a); } void add(int a,int b) {     system.out.println("two int parameter passed"+a+" "+b); }     void add(int a,int b,int c) {     system.out.println("three int parameter passed"+a+" "+b+" "+c); } void add(char x) {     system.out.println("one char parameter passed"+x); } void add(char x,char y) {     system.out.println("two char parameter passed"+x+" "+y); }     void add(char x,char y,char z) {     system.out.println("three int parameter passed"+x+" "+y+" "+z); } public static void main(string []args) {     overloading d=new overloading();     d.add(z); } } 

when use d.add(1) or other works using d.add("p") not work me guys .... , thanx in advance

by using call:

d.add("p");// calling add() parameter of type string  

there no such method , causing error. in order make work wither use:

d.add('p');// considered char parameter 

or add string parameter method as:

void add(string x) {     system.out.println("one string parameter passed"+x); } 

hope help!


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -