"An interface cannot contain an implemented method which affects instance state. An abstract class can. "
An interface can contain implemented methods?
"A concrete implementing class of an interface that declares a default method does not have to provide an implementation for the default method whereas a concrete subclass of an abstract class has to provide an implementation for all the abstract methods in its class hierarchy. "
The first concrete class implementing an interface must implement its methods, no?
" An interface cannot contain an implemented method which affects instance state. An abstract class can. "
I don't think they can, regardless.
"Actually an interface can, but only through methods defined on the interface itself. Map.putIfAbsent is a good example. "
Jelle Klap wrote:Default methods were introduced in Java 8, yes.
Good, thanks. In that case Associate Certification (OCAJP 7/8) might benefit from being split into two. I thought the differences at this level were just a couple of additions.
Ok, not split into two, but there should be a stick highlighting the differences between the two at the OCAJP test level.
Guillermo Ishi wrote: There should be a sticky highlighting the differences between the two at the OCAJP test level.
I don't see why.
If you take a look at the OcajpFaq, you'll find links to
Ashwin Rao wrote:These default methods have to be static?
No. There were two types of methods that were introduced to interfaces in Java 8:
1) Default methods - provide a default implementation so that implementers don't have to (but can) implement the method.
2) Static methods - provide a method you can call directly on the interface without implementing an instance of an implementing class
Guillermo Ishi wrote:I'm fairly observant here and I had no idea, and it accounts for some of my stellar grade on the 8 beta.
Then I can definitely recommend following the Features new in Java 8 forum as well.
Guillermo Ishi wrote:To be fair, a lot of the things you're linking to weren't up back then, some time last year.
The mappings between OCA7 and OCA8 exams were added on October 4, 2014 which was after the OCA8 beta exam (released on August 31, 2014) but way before the official release of the OCA8 exam (on January 10, 2015).
And I assume the first step you take when you decide an exam preparation is to read the official certification exam page with the exam objectives. So you know what you need to study to pass the exam. And even during your prepation it's recommended to check the objectives once in a while, because (as you probably know) Oracle can change them whenever they like.