This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static code in abstract class

 
S Reddy
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read "abstract classes shouldn't contain static blocks" from Complete reference book. Is this true?

When static blocks are associated with class, why they couldn't be included in abstract classes?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't think of any reason for a blanket statement like that. Don't know what this "Complete" book is, but if you have a book that makes claims like this without explaining them, I'd use it for kindling.

If the book includes an explanation and you'd like help understanding it, please share it with us!
 
S Reddy
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no explanation. The book is "Java 2 Complete Reference, 5th edition" by TATA - McGraw Hill. Author is: Herbert Schildt.
 
camilo lopes
Ranch Hand
Posts: 202
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you include the code?
 
S Reddy
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no code given in the book. He just mentioned that abstract classes should not contain static blocks. I am just confused why java was developed like that?
 
Shivit Agarwal
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the statement is incorrect in case if he has written such. If you don't believe write a short program to prove your point.

Also can you please mentioned the Page No. in which you came across the statement.
 
S Reddy
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic