This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Modifiers" Watch "Modifiers" New topic


Gaia Nathan
Ranch Hand

Joined: Aug 01, 2001
Posts: 62
Hi all,
I know that the abstract and final modifiers cannot be used together, but are there any other restrictions on the other modifiers, such as native, transient and so on?
Also, can static and transient modifiers be used together?
Thanks in advance for the help.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Best suggestion in learning what modifiers can be used together is to just create a bunch of classes with different combinations and see what the compiler thinks.
In regards to static and transient, if you try it, you should see no problems. Since the two don't really have anything to do with each other, I don't see why there would be a problem (unlike final and abstract, which obviously have a relation).
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9056

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Wasn't aware statics weren't serialized, wondered about that after answering the question, makes sense since you're writing the object, and statics aren't associated with an object. Guess that would be why there is no conflict
I agree. Here's the link:
subject: Modifiers
It's not a secret anymore!