File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can non abstract methods can access abstract methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can non abstract methods can access abstract methods" Watch "Can non abstract methods can access abstract methods" New topic

Can non abstract methods can access abstract methods

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
I am preapring for Java interview, I came across this question.
Q) when you declare a method as a abstract, can other non abstract methods can access it?
Ans)Yes,other non abstract methods can access a method that you declare as a abstract.

I think this anwer is wrong.

Q1)Please correct me if i am wrong?

Henry Wong

Joined: Sep 28, 2004
Posts: 18545


And "access" is the wrong word -- as you technically can't access anything that doesn't exist -- maybe "allowed to call" is better.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Oguzhan Acargil

Joined: Apr 16, 2010
Posts: 6

Try to google Template pattern...

A subclass implements abstract methods. In order to access non abstract methods in an abstract class, you have to intiate it with a subclass. Thats way there is no problem.

I wish it is clear
Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
Yesss.....Non-abstract method can call Non-abstract method

Reason :- Compiler ensures that we cannot create an object for an abstract class.
This means whenever we could call that non-abstract method, it would be called only from the class which extends the abstract class.
In that case , the class which would extend the abstract class has to implement the abstract method.
So it is possible to call it !!!

SCJP 6.0 96%

(Connecting the Dots ....)
I agree. Here's the link:
subject: Can non abstract methods can access abstract methods
Similar Threads
Access Modifiers
few questions
Java Grammer/ Reg Ex For method identification
Abstract Classes / Methods
Examlab generics question