public class MyName {
static int sum(int n1, int n2) {
return n1 + n2;
}
public static void main(String[] args) {
System.out.println("Sum==" + sum(10, 50));
}
}
public class MyName {
static int sum(int n1, int n2) {
return n1 + n2;
}
static float sum(float n1, float n2) {
return n1 + n2;
}
public static void main(String[] args) {
System.out.println("Sum==" + sum(10, 50));
System.out.println("Sum==" + sum(10.5f, 50.7f));
}
}
public class MyName {
static int sum(int n1, int n2) {
return n1 + n2;
}
static float sum(float n1, float n2) {
return n1 + n2;
}
static float sum(int n1, float n2) {
return n1 + n2;
}
public static void main(String[] args) {
System.out.println("Sum==" + sum(10, 50));
System.out.println("Sum==" + sum(10.5f, 50.7f));
System.out.println("Sum==" + sum(10, 10.5f));
}
}
public class MyName {
static float order(float total) {
return total;
}
static float order(float total, int deliverycosts) {
return total + deliverycosts;
}
static float order(float total, int deliverycosts, String promo) {
return total + deliverycosts - 2;
}
public static void main(String[] args) {
System.out.println(order(15, 3, "Ahmed"));
}
}
public class MyName {
static void fun() {
System.out.println("fun:");
}
static void fun(int x) {
fun();
System.out.println("x==" + x);
}
public static void main(String[] args) {
fun(15);
}
}
public class MyName {
public static void main(int num) {
System.out.println(num);
}
public static void main(String[] args) {
main(500);
}
}
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