Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Triggers - following Doug's post

 
Lisa French
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought this might be a good thread to start.
Triggers to look for in code example test questions: Doug said that he looks for triggers in the code examples to immediately draw him toward a syntax error or non compilation issue.
Copied from his post in another topic:
- wait(), join(), sleep() : Look for try/catch block to catch InterruptedException.
- case: x : Look for x as non-final variable... Compiler error.
- [top level class] : Look for any other access modifier besides public and [default access]... Compiler error.
- [non-anonymous, method-local, inner class] : Look for semi-colon at closing bracket. If not there... Compiler error.
- ["final" base class method] : Look for shadowing in child method, access from child method.
- [Wrapper Class].[Any Method] : SUPER CLOSE SCRUTINY! could be NFE Error, incorrect return type.

Does anyone else have any good triggers?
 
Brian Joseph
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

- [non-anonymous, method-local, inner class] : Look for semi-colon at closing bracket. If not there... Compiler error.
- ["final" base class method] : Look for shadowing in child method, access from child method.

Change non-anonymous to just anonymous
Also, if you declare a base method as final, how can you "shadow" the method in a subclass? Because it's final you get a compile error at any attempt to override it.
[ June 19, 2003: Message edited by: Brian Joseph ]
 
Jon Poole
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads : look for syncronized block around wait and notify.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static nested class: look for access to instance fields and instance methods of enclosing class (compiler error)
non-static nested class: look for declaration of static field, static method or interface (compiler error)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic