java - Unreachable Statement Error Message -


i making simple program. when compile it, bluej says "unreachable statement" , highlights "system.out.println(mystery("deliver"));". i'm unsure do. complete println statement , run in main method, gives me same error.

public class test7 {     public string mystery(string s)     {         string s1= s.substring(0,1);         string s2= s.substring(1, s.length()-1);         string s3= s.substring(s.length()-1);          if (s.length() <= 3)             return s3 + s2 + s1;         else              return s1 + mystery(s2) + s3;         system.out.println(mystery("deliver"));     } } 

whether if-statement true or false, return, println statement cannot reached.

maybe became clearer once corrected bad indentations.

cannot answer should do, since haven't declared intention. did intend println statement in separate main method, perhaps?


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -