aspose file tools*
The moose likes Beginning Java and the fly likes question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "question" Watch "question" New topic
Author

question

Tara Salehi
Greenhorn

Joined: Apr 10, 2008
Posts: 6
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
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

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!


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question
 
Similar Threads
SCJD and SCWCD
Regarding Multiple inheritance
AJAX query
Slideshow via Array question
question