wood burning stoves*
The moose likes Beginning Java and the fly likes I want to create a class but the class no longer useful in other place Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I want to create a class but the class no longer useful in other place" Watch "I want to create a class but the class no longer useful in other place" New topic
Author

I want to create a class but the class no longer useful in other place

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
I want to create a class but the class no longer useful in other place,

how I create class,please suggest

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

What do you mean, the class is no longer useful in other places?

Please give more details about what you're trying to do.
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576


here the class b is used only inside of class A, no where else it is used.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Perhaps you could define it as an inner class?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
please suggest what type of inner class best suited for this and using an inner class is a best practice?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

I use inner classes only when the class only makes sense within the context of the parent class. I think it is something that is overused in general and your caution is warranted.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I want to create a class but the class no longer useful in other place