What does the $ means, EventQueue$1.class(Red marked)

Attached picture
http://i39.photobucket.com/albums/e179/iamcreasy/Untitled-6.jpg

I am using NetBeans.

Recommended Answers

All 2 Replies

$ is used as a separation marker for denoting inner classes. For e.g. consider the following class:

public class MyWidget {
	
	static class Oh {
	}
	
	public void doIt() {
		final Runnable r1 = new Runnable() {
			@Override
            public void run() {
            }
		};
		final Runnable r2 = new Runnable() {
			@Override
            public void run() {
            }
		};
		r1.run();
		r2.run();
	}
	
}

Here; four class files would be created:

  1. MyWidget
  2. MyWidget$Oh.class
  3. MyWidget$1.class
  4. MyWidget$2.class

Basically, the format is: OuterClassName$(InnerClassName or number in case of anonymous class).class. In the above case, since we have two anonymous Runnables created, we have $1.class and $2.class.

In case you are unaware of nested classes, more details at: http://download.oracle.com/javase/tutorial/java/javaOO/nested.html

commented: Perfect answer! +3

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.