+ 5
Java: why can't a method be private and abstract at the same time?
2 ответов
+ 14
Because if you declare a method as a private, then that method is only accessible in withen class.
But if you put an abstract keyword in that method, it means that method is either inside the interface or inside the abstract class.
and you know very well if you declare method as abstract that means that method is not definable in that interface or in that abstract class.
So if you delcare method as private and abstract at the same time that mens this method is unusable.So you cannot keep the method private and abstractat a time.