In Inheritence concept, i have a static method in super
class and i am inheriting that class to one sub class.in
that case the static method is inherited to sub class or
not????

Answer Posted / venkat.kanneganti

Hi,static methods are methods are inherited.
example
class A {
static void methA() {
System.out.println("inside methA");
}
}
class B extends A {
public static void main(String[] args){
B.methA();
}
}
output:inside methA

Is This Answer Correct ?    20 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are disadvantages of java?

510


Can you inherit from an abstract class java?

520


What is meant by object oriented programming – oop?

535


Is java still necessary?

609


What is the difference between compare and compareto in java?

485






What is == and === in javascript?

551


Define inheritance with reference to java.

572


What is the maximum size of a string in java?

539


How do you get length in java?

550


Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?

581


How do you invoke a method?

531


Why is java multithreaded?

523


how to create multithreaded program? : Java thread

494


Why is a constant variable important?

490


What are java packages? What is the significance of packages?

558