Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface problem

 
deepesh mathur
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am writing this post to ask that:
1.is it necessary for an interface to have an concrete class(non abstract)implementation? what i mean to say is that can we have a source file compiled with only interfaces and it's implementing abstract classes without a non abstract class???


2.is it the same case with a class extending an abstract class???
i.e. is it necessary to give an non abstract class extending an abstract class to compile code correctly???



i know i am a bit confused so kindly help...
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried this?

Compilation is one thing. Instantiation is another.
 
deepesh mathur
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry but actually i can't get you really ...
 
Henry Wong
author
Marshal
Pie
Posts: 21409
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by deepesh mathur:
sorry but actually i can't get you really ...


Basically, Marc is saying... Yes, it will compile. But what are you going to do with interfaces that don't have any implementations?

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic