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 4026190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:56:22+00:00 2026-05-20T10:56:22+00:00

I want to return the value of my array plus the return value of

  • 0

I want to return the value of my array plus the return value of the recursive call.

However, for some reason, Java does not want to have the method name after the constructor.

In addition, when I tried to convert the method into another method, I get an error when I use isPalindrome.

I change my program around but I’m still getting errors.

public class isPalindrome {
    /**
     * This is the main entry point for the application
     * @return 
     */
    public static boolean main(String[] args) {
        
        String[] word = {"KayaK", "Desserts, I stressed"};

        
        
        boolean isPalindrome(String[] array, String s, String I) {
            
            if(i.charAt(0) == s.charAt(0)) {
                System.out.println("You entered a Palindrome");
                return true;
            }
            else {
                System.out.println("You didn't entered a Palindrome");
            }
        }
        
        
            try {
                System.in.read();
            } catch (Throwable t) {
            
            }
    }
}
  • 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-05-20T10:56:22+00:00Added an answer on May 20, 2026 at 10:56 am

    You can’t use the class name as the name for a method. The only “methods” that can share a name with the class are constructors.

    One fix would be to rename your class from isPalindrome to PalindromeFinder or something. That would also better align with Java naming conventions.

    EDIT: Note that you never actually called your method in main; you tryed to assign a local variable to isPalindrome. That does not actually call the method. You would need to invoke the method with isPalindrome(...put your parameters here...) and store the result in a variable with a name that isn’t being used.

    Also note that a method can only return a single value (a single primitive or a single object). If you really want to return an array AND a boolean (and I’m not sure you do), you would have to store those in an object and return that object.

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

Sidebar

Related Questions

I have a method. I want to return a value not from the main
I have a string, root?param1=...&param2=...&param3=... , and I want to create a java method
I want to be able to access the array directly from the return value
I want to pass the contents of an array to another method and have
I want to search an array by value, not by key. It's an array
Suppose we want to return a value from a function based on a condition.
Possible Duplicate: Return value from thread I want to get the free memory of
I want to negate the return value of a function in a cool way.
I want to pass HTMLPage as a return value of my WCF REST Service
I want to iterate over all childs of a jQuery's .children() return value, like

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.