• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

OCP Java SE 8 Programmer II Study Guide (Sybex 809) page 178, Chapter 4

 
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,
I am very new to the topic "Functional Programming"
I have  a question about page 178, Chapter 4- Functional Programming of the book in the subject:



why is it here "class" and not "interface"?

I both double checked here and a bit on the web, despite quickly,  didn´t find anything relevant to this page so I assume is correct.

Also, simply, if I try to compile the "similar" code below in file "Ruggero.java"



I get error :


Ruggero is not a functional interface
Ruggero.java:3: error: missing method body, or declare abstract
       R apply(T t);
         ^
2 errors



I 'd dare to say, at page 178, it should be interface and not class.

Where am I wrong?

thanks
 
Saloon Keeper
Posts: 1277
38
Eclipse IDE Postgres Database C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is correct that only an interface, not an abstract class that happens to have exactly one abstract method, is eligible to be used as any FunctionalInterface.

I don't have that book (I have the one for the 816/819) but I remember that as a basic part of the studies.

It seems logical enough for them to have allowed abstract classes to be used as functional interfaces, but they did not decide that.
 
Ruggero Montesi
Greenhorn
Posts: 17
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jesse!
I actually checked the  OCP Java SE 11 Programmer II Study Guide (Sybex 816) and actually there (at the same section "Implementing Function and BiFunction" page 181) is interface, not class.
(I have also Java 11 book, I´m "bookaholic" and "Javaaholic" but still I need to learn the base )
Thanks again for your quick reply!

 
Jesse Silverman
Saloon Keeper
Posts: 1277
38
Eclipse IDE Postgres Database C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been feeling somewhat positive about the OCPJP.

Sure, it is sort of just the boring parts of programming, BUT...when doing something very hard like the coding challenges for Amazon, Facebook, Google, etc. ...

I spend FAR less time thinking about how to use Java correctly, which gives me more time to actually work on the problem itself.

So, sure, "you can look everything up" but when there is a lot of stuff that someone else might be looking up and you are instead just working away on whatever problem, because you know just how to do whatever....I am saying I am actually finding the results of all the studying helpful (I haven't taken the exam yet).
 
Ruggero Montesi
Greenhorn
Posts: 17
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I absolutely agree with you!
My sentence "(I have also Java 11 book, I´m "bookaholic" and "Javaaholic" but still I need to learn the base ) " is referred to the possible inconsistency in what I was saying... I am studying for Java 8 OCP and I have also the books for Java 11.
Is not that weird?
A bit yes, but since I got already OCA8 would like to "finish" java 8 and then go to 11.
And I got the books (for a path I am not currently studying for) because they're simply a must in my opinion.

By the way OCA certificate allowed me to reconvert to IT from a completely different sector and I kept on studying Java because  of this nice "certification infrastructure". To me it helped to learn in a systematic way.
Coming from a different background I personally needed a "guidance" to keep me on track and I found it in the certification paths and books.
So I wouldn't be in Java now without the OCA-OCP stuff.
Sorry if the above is off-topic, thanks again for your reply!
 
Jesse Silverman
Saloon Keeper
Posts: 1277
38
Eclipse IDE Postgres Database C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It isn't off-topic at all!

Regarding Java 8 vs. Java 11.

It is only quite recently that some of the major platforms (e.g. HackerRank) that we have to use for interview/test purposes even allows anything newer than Java 8.

I am taking the Amazon Coding Challenge (necessary for any developer jobs at Amazon) and noted that in the Sample/Practice one I took yesterday that the highest Java version one was allowed to select was, in fact, Java 8.

In addition, there are a couple of topics (I am only thinking of LocalTime/LocalDate at the moment, but I believe there are others) that are only covered on the 808/809 but have been dropped from the 819 due to just too much being in scope.  "Java 8 tests" being given by major employers include LocalDate/LocalTime, and I believe some of those others only on the earlier tests.

So there are multiple reasons to want to know everything for the Java 8 certification.

There are a LOT of major things only on the Java 11 exams because they are newer than Java 8, some of them are much nicer ways to do things that we have been doing for a long time.

If you take a Java 8-based exam, or need to work on code still based on Java 8, it can be a bit tricky to remember what those all are so you don't accidentally try to use them in those contexts.

Lastly, I am glad that you have found success, and find the way preparing for the certification helped you to be interesting.

Cheers!
 
Why is the word "abbreviation" so long? And this ad is so short?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic