This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

why compile the file there are two class file was created?  RSS feed

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 91.
Read the following code excerpt carefully. //Contents of file A.java
Which of the following are true
1.A.java cannot be compiled. Duplicate defination of inner class B.
2.A.java compiles without any error. An attempt to run C as an application will cause runtime linkage error. Duplicate definations of inner class B are found
3.Only one class file corresponding to the inner class B is created in the file system.
4.Two class files corresponding to both inner classes (B) is created in the file system.
5.The classes compile cleanly and on running C as an application causes "I am in the arg constructor" to be printed on the console

the given ans is;4.5.
I dont know why there there are two class file(A$1$B.class ,A$2$B.class)of class B is created when i compiled the code.

(Marilyn added code tags)
[This message has been edited by Marilyn deQueiroz (edited November 03, 2001).]
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two class files A$1$B.class and A$2$B.class are created as A.java has two constructors and both of them have inner classes.
Rashmi
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the class file of the inner class will be also generated along with the generation of the driver's class. so in this case, A.java has two inner classes B in each of its constructors, therefore, two B.class will be generated.
arthur
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!