Advertisement

Java Tutorials | Why Abstract Method cannot be declared with Private? by DURGA Sir

Java Tutorials | Why Abstract Method cannot be declared with Private? by DURGA Sir The Most Common UNANSWERED Java Interview Question
==================================================
Q. Why abstract method cannot be declared with private?

abstract method: The method which has only declaration butnot implementation.

Child classes are responsible to provide implementation for parent class abstract methods.

private vs abstract:
-----------------------
parent class abstract methods should be visible to the child classes, then only child class can provide implementation.

But private methods are not visible to child classes.

abstract class Vehicle
{
private abstract int getNoOfWheels();
}
class Bus extends Vehicle
{

}

illegal combination of modifiers: abstract and private

#durgasoftware #Java #CoreJava

core java by nagoorbabu sir,core java online training,Core java tutorial,Core java tutorial for beginners,Core java certification training,Core java concepts,Core java training videos,Core java programming,durgasoft Core java videos,Durga java videos,learn java online,learn core java online,java online course,java online training,java programming tutorial,java programming for beginners,java tutorial for beginners,java for beginners,

Post a Comment

0 Comments