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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static inner class" Watch "static inner class" New topic
Author

static inner class

Ed Zeval
Greenhorn

Joined: Jun 19, 2008
Posts: 21
Hi,

I have a couple of inner classes in my code. Someone told me that I should make them static. Why would I want to do that?

Thanks!
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
What do your inner classes do? and what does your outer most class do?

Justin Fox


You down with OOP? Yeah you know me!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Do you know what the difference is, technically?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

If the inner class references some instance fields or methods of the outer class you will probably not even be able to make it static.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
provide some sample code if you want specific assistance


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static inner class