override the static method in java code example

Example 1: can we overload a static method in java

package test.main;
 
public class TestOverload {
 
	public static void main(String args[]) {
 
		TestOverload.show();
		TestOverload.show("FrugalisMinds");
	}
 
	public static void show() {
		System.out.println("Show Called ");
	}
 
	public   void show(String name) {
		System.out.println("Overloaded Show Called" + name);
	}
}

Example 2: can we overload a static method in java

package test.main;
 
public class TestOverload {
 
	public static void main(String args[]) {
 
		TestOverload.show();
		TestOverload.show("FrugalisMinds");
	}
 
	public static void show() {
		System.out.println("Show Called ");
	}
 
	public static void show(String name) {
		System.out.println("Overloaded Show Called" + name);
	}
}

Tags:

Java Example