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

null strategy with enums/design patterns

 
blondy khosa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


public class TestStrategy{
private Strategy getStrategy(){
if(true){
return Strategy.DOCALCULATIONS;}
if(false){
return Strategy.DOANOTHER;}
return null; // my code will not work...I want to return a null strategy but //I don't how to do it...I have just started working with enums....please help with an example of code on how to do it
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic