Example & Tutorial understanding programming in easy ways.

Can we override the static method?

The answer is Yes. We can have two ore more static methods with same name, but differences in input parameters.

For example, consider the following Java program.

example:

public class javatest {

public static void fun() {

System.out.println("javatest.fun() called ");

}

public static void fun(int a) {

System.out.println("javatest.fun(int) called ");

}

public static void main(String args[])

{

javatest.fun();

javatest.fun(10);

}

}

output :-javatest.fun() called

javatest.fun(int) called

 

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!