Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:52:24+00:00 2026-06-11T21:52:24+00:00

I need to reverse Hello. using recursion so that the end result does not

  • 0

I need to reverse Hello. using recursion so that the end result does not have a .

My current method is:

public void foo(){
    Scanner scan = new Scanner(system.in);
    char c = scan.nextChar();
    if (c!='.')
        foo();
    System.out.print(c);
}

This seems to output the reverse, however it still has the .. Can someone point me in the right direction to get rid of the period?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:52:25+00:00Added an answer on June 11, 2026 at 9:52 pm

    Use '.' instead of "." since you are comparing a char, not a String:

    public void foo(){
      Scanner scan = new Scanner(system.in);
      char c = scan.nextChar();
      if (c != '.') {
        foo();
        System.out.print(c);
      }
    }
    

    Also note that if it were a String, you’d need to use equals to do the comparison. == or != is used to compare primitive types, such as char.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have strings that need converting like so, 'hello world' = 'helloWorld' And also
I have a script that I need to reverse engineer, but the script appears
We have an old legacy app that we need to reverse engineer how it
Using C#, I need to do a reverse look up my resource file. I
I have nginx acting as a reverse proxy to apache. I now need to
I have nginx setup, acting as a reverse proxy to apache. However, I need
I need to reverse result from mysql query, but i cannot use ORDER BY
I need to reverse geocode two locations from and to. Using the geocoder gem
I am using http://mess.genezys.net/jquery/jquery.async.php for loop and need to reverse the order of the
I have a Blackberry project that I'm working on and I need to convert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.