• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Event

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




Which of the following statements is true about the above code?

A. The code will not compile complaining that no layout has been defined for the frame.
B. The code compiles and doesn't display anything.
C. The code runs and shows a single button occupying the whole frame. On clicking the button you get the message "hello" at the Std o/p.
D. The code does not compile complaining about the inaccessibility of a certain variable.
E. The code doesn't compile complaining that the constructor for fram has not been defined.
ANS : D
I don't know why.

[I added UBB CODE tags to your source code to make it more readable. Please try to use
them in the future. Learn more about UBB codes here - Ajith ]
[This message has been edited by Ajith Kallambella (edited September 27, 2000).]
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't you have Java compiler?? If not, you have gotten started on the wrong foot.
If you do have a Java compiler, please compile this code and see what the error is. If you don't understand, come back here with the compilation error and we can continue the discussion.
Ajith
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
code won't compile because the anonymous class only has access to local variables declared FINAL... since msg is not final, it is inaccessible...
 
reply
    Bookmark Topic Watch Topic
  • New Topic