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
Explain about static nested classes in java?
What is array and arraylist in java?
What are scalar data types?
What are different types of control structures?
What are the new features in java 8?
In java, what is the difference between method overloading and method overriding?
What happens when a thread cannot acquire a lock on an object in java programming?
Can we create an object of private class?
What are the steps in the jdbc connection?
What is the purpose of a volatile variable?
Why packages are used?
What is Major and importance difference between for and foreach loop ?
How do you do absolute value in java?
what is encapsulation in java? Explain
What is final class?