This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Chapter 1 page 47

 
pablo santamarta esteban
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the beginning, second paragraph says:

'Finally, you need to know that -for top-level classes- the abstract modifier can never be combined with the static modifier. We'll cover static method later in this objective, but for now just remember that the following would be illegal:
abstract static void doStuff();'

The phrase in bold should be removed? As top-level classes are not allowed to be marked as static and it is actually talking about methods.

 
Roel De Nijs
Sheriff
Posts: 10763
148
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pablo santamarta esteban,

First of all, a warm welcome to CodeRanch!

pablo santamarta esteban wrote:'Finally, you need to know that -for top-level classes- the abstract modifier can never be combined with the static modifier. We'll cover static method later in this objective, but for now just remember that the following would be illegal:
abstract static void doStuff();'

The part in bold is important and should not be removed! Because you can create a static nested class which is abstract. Illustrated in the following code snippet:So Pizza is a static nested abstract class, so the combination is allowed for static nested classes, but not for top-level classes. So without the part in bold, that statement would be clearly incorrect (as shown in this code snippet).

Hope it helps!
Kind regards,
Roel
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!