Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data class with package (default) access vs public

 
David Fishman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In the interest of hiding the data access details from the GUI client I have created an adapter interface and class as already discussed in many threads. In addition, I am thinking of changing the access to the Data class from public to package (default), so that the only methods accessible to the GUI client would be the adapter ones.
I have actually seen this suggested in previous threads, with some warnings that this may not be acceptable (though I can not see any "musts" being violated by this), or that Sun's automated checking actually expects the Data class to have public access and would fail the submission otherwise.
Has anyone implemented the above and passed, or knows of other people's experience ?

Thanks
 
David Fishman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To all who are interested, I actually emailed Sun regarding this and they replied that it is acceptable for the Data class to have default access.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic