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 is a java lambda expression?

809


What is meant by memory leak?

760


What is a class in java?

816


How can we create a thread in java?

822


What is meant by javabeans?

859


Is it possible to compare various strings with the help of == operator?

786


Why singleton pattern is better than creating singleton class with static instance?

815


Can a private method be declared as static?

805


What is the method in java?

866


What is final int?

753


What two classes are used to read data only?

879


What is an class?

796


What are the four pillars of java?

933


Why java applets are more useful for intranets as compared to internet?

838


How to make a class or a bean serializable?

757