Hi all,
consider below code:
public class Bertha {
static String s = "";
public static void main(String[] args) {
int x=4;
Boolean y = true;
short[] sa = {1,2,3};
doStuff(x,y);
doStuff(x);
doStuff(sa,sa);
System.out.println(s);
}
static void doStuff(Object o){
s += "1";
}
static void doStuff(Object... o){
s += "2";
}
static void doStuff(Integer... i){
s += "3";
}
static void doStuff(Long L){
s += "4";
}
}
output : 212
here i have doubt that how Object... o have been called for doStuff(x,y) and for doStuff(sa,sa);
could anyone explain what goes around here.
Thanks in advance.
surya55 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.