Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question

 
Tara Salehi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all
I have a question about JAVA
I know that we have internal in C# and we dont have it in java
but I need that definition in myprogram that is in java.how can I perform it ?
thanks
 
Henry Wong
author
Marshal
Pie
Posts: 21116
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tara Salehi:
Hello to all
I have a question about JAVA
I know that we have internal in C# and we dont have it in java
but I need that definition in myprogram that is in java.how can I perform it ?
thanks


Well, it's kinda hard to answer your question, since it depends on another definition in C#.

If you are looking to retrict access to the same package, you can either use the "protected" modifier which includes package access, or don't provide a modifier, which by default, is package access.

If you are looking to retrict access to the same jar file, there really isn't a close equivalent. The best option is probably to make the access public, but don't document it, so it won't be know outside of your jar file. (BTW, please correct me if I am wrong here -- there may be a cool technique that I don't know about)

Henry
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Wong:

If you are looking to retrict access to the same jar file, there really isn't a close equivalent. The best option is probably to make the access public, but don't document it, so it won't be know outside of your jar file. (BTW, please correct me if I am wrong here -- there may be a cool technique that I don't know about)


No, that's about it. The Eclipse folks use a naming convention for this -- the contents of packages whose names contain the segment "internal" are not intended for use by other plugins. If there was anything better, they'd be using it!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic