Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

about inner classes

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
I came accross Synthetic keyword. I have idea that it will be encountered in inner classes. can any one elaborate more about it with example(s)?

Adv thanks
 
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

rami

What is that keyword?

Where did you get that keyword?

Thanks

Anil Kumar
 
Ranch Hand
Posts: 652
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I came accross Synthetic keyword




Hearing it first time
 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you sure its "synthetic"?? must be a typo it should be static inner class...
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no "synthetic" such type of keyword in java


SCJP1.4--- 77%
 
Ram Reddy
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i come accross this keyword in compiled code. The original version contains inner classes and members of inner class. for memebers for innner class we are using synthetic keyword. but i dont know about it exactly. I think it is internally compiler is using to distinghuish between normal variable and inner class variables ?
 
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hava a look at the Java Virtual Machine Specification
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Specifically section 4.7.6 of the Java VM Specification explains what the Synthetic attribute is.

It is not a keyword in the Java language. It is used in class files for things that are automatically generated by the compiler. For example, if you write a class without any constructors, the Java compiler will automatically create a no-args constructor. That no-args constructor will have the Synthetic attribute in the class file.

I'm 99% sure that this is something you don't need to know for the SCJP exam.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!