• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

thread blowing my mind

 
Ranch Hand
Posts: 789
Python C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is from a Java 8 thread here. Is there this big a diff between 7 and 8?

"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. "

It can?


https://coderanch.com/t/647931/java/java/Difference-abstract-class-interface-default

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what's actually the mindblowing part?
 
Guillermo Ishi
Ranch Hand
Posts: 789
Python C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:And what's actually the mindblowing part?


The quoted italics are from the thread. The rest is how I would respond to those.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Default methods were introduced in Java 8, yes.
 
Guillermo Ishi
Ranch Hand
Posts: 789
Python C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillermo Ishi wrote:Is there this big a diff between 7 and 8?


Yes! For me lambda expressions and streams are the biggest change to Java programming since the generics and annotations were added in Java 5.
 
Guillermo Ishi
Ranch Hand
Posts: 789
Python C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There should be a sticky highlighting the differences between the two at the OCAJP test level.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
  • the official exam certification page (with exam topics) of both OCA7 and OCA8 exams
  • a mapping between the exam objectives of OCA7 and OCA8 exams
  • and even a mapping between OCA7/OCP7 and SCJP/OCPJP6
  •  
    Guillermo Ishi
    Ranch Hand
    Posts: 789
    Python C++ Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'm fairly observant here and I had no idea, and it accounts for some of my stellar grade on the 8 beta. Do whatever you want.
     
    Ranch Hand
    Posts: 89
    Python C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Default methods were introduced in Java 8.

    These default methods have to be static?
     
    author & internet detective
    Posts: 41860
    908
    Eclipse IDE VI Editor Java
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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
     
    Roel De Nijs
    Sheriff
    Posts: 11604
    178
    Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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
    Ranch Hand
    Posts: 789
    Python C++ Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    To be fair, a lot of the things you're linking to weren't up back then, some time last year. Just be careful to carefully distinguish between the two tests and to not let a free service turn into a free disservice.
     
    Roel De Nijs
    Sheriff
    Posts: 11604
    178
    Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic