class CompileTimePoly {
// Static polymorphism, Method overloading(same name, same class, diff parameters:- type, number, sequence)
void method1(int a, int b) {
System.out.println("1");
}
void method1(String a, int b){
System.out.println("2");
}
public static void main(String[] args) {
CompileTimePoly compileTimePoly = new CompileTimePoly();
compileTimePoly.method1("hello",5);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter