[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Recursive Helper Method - no output

Posted on 2013-12-03
1
Medium Priority
?
303 Views
Last Modified: 2013-12-03
public class Sheldon {
public static void main(String[] args) {
     
           reverseDisplay("123456");
}
    public static void reverseDisplay(String value){
        reverseDisplay(value, value.length() -1);
        }
    public static void reverseDisplay(String value, int high){
        if (high < 0){
            System.out.print(value.charAt(value.length()-1));
            reverseDisplay(value.substring(0, value.length()-1));
    }
    }

}

Open in new window


This builds with no problem but there is no output. I would expect to see 654321 on the console.
0
Comment
Question by:lostinspace9
1 Comment
 

Accepted Solution

by:
lostinspace9 earned 0 total points
ID: 39692485
nevermind...It was a small mistake... High should be >= 0.. Thanks anyhow.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month20 days, 3 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question