Solved

Recursive Helper Method - no output

Posted on 2013-12-03
1
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

696 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