0

In my program, I have several class variables whose access specifier is known as private package.

The default accessor specifier in Java is known as private package where it is accessible within the package which the class belongs to.

For the UML class diagram , should I label these variables as public or private? I can't decide because of this concept of private package.

2
  • 1
    Why don't you label them private package? That's what the accessor specifier is, right? Commented Apr 7, 2014 at 2:22
  • @RobertHarvey For UML diagram , by convention , there is only public , private ,protected which is represented by + , - , # respectively. There is no symbol to represent private package Commented Apr 7, 2014 at 8:11

1 Answer 1

2

If the tool you use for drawing the UML diagrams doesn't provide the (language specific) access specifier that you need, you can still draw a useful class diagram.

The easiest way is just to leave out all the access specifiers. This doesn't mean that everything is now public, but rather that the diagram doesn't tell you if the members are public, private, package private or something else.

If you do want to show access specifiers, you also could label the package private members as protected members. While technically incorrect, protected access is the closest in meaning to package private access and is usually used only very little, so you could just add a note to your diagram that the protected access specifier should be read as package private.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.