File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes What is synthetic class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is synthetic class?" Watch "What is synthetic class?" New topic

What is synthetic class?

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi all genius people,

Can anyone explain me what is Synthetic class in java?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46356
Hardik Trivedi wrote:Hi all genius people
No need to be sarcastic.

Have you searched anywhere?
David Newton

Joined: Sep 29, 2008
Posts: 12617

I don't think anybody was being rude/sarcastic.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
First of all I am not being sarcastic. OK.

And I searched a lot about synthetic class,but only thing I found is it is related to $..
Some where in class file $ sign is put.And it is a class created runtime by JVM.
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
A people who know little bit of Java is just genius and a person with marvelous brain power.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20273

You overestimate us. Well, all but me of course

How To Ask Questions How To Answer Questions
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15083

A synthetic class (or method) is a class (or method) that is generated by the compiler. For example, if you create an anonymous inner class in your code, like this:

Sun's Java compiler will create two class files when you compile this: MyClass.class and MyClass$1.class. The second one, with the $1, is a class that the compiler generates for your anonymous inner class.

Normally you don't need to deal with synthetic classes or methods when you're a Java programmer.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: What is synthetic class?
It's not a secret anymore!