troubleshooting Question

java string challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
JavaJava EEProgramming Languages-Other
12 Comments2 Solutions427 ViewsLast Modified:

I am working on below challenge
i wrote as below
public String theEnd(String str, boolean front) {
return str.substring(0,1);
  return str.substring(str.length()-1);


i would like to know how can improve on my above code. Thanks in advacne
Join our community to see this answer!
Unlock 2 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros