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
Post a Comment