• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Help me guys !i need u'r help

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String s = "message";
Frame f = new Frame();
f.add(btn);
btn.addActionListener(
new ActionListener() {
void ActionPerformed() {System.out.println(s);}
}
)
f.pack();
f.setVisible();
What will you see on screen?
A.Output "message"
B.compile OK, but nothing is shown because the button is not properly added
C.compiler error because s can not be used there
D.compiler error because the listener is not constructed correctly
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is D, 'coz the semicolon ';' is missing in then end of the addActionListener method call, i.e., after the bracket.
-Aman
 
Water! People swim in water! Even tiny ads swim in water:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic