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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:21:17+00:00 2026-06-01T04:21:17+00:00

I have several questions I need help with. I’ll add both my code and

  • 0

I have several questions I need help with.

I’ll add both my code and source code (I guess what assignment asks for clarification) in here.

Service Class

public class Palindrome
{    
   private String pal;

    public Palindrome()
    {
       pal = " ";
    }

    public Palindrome(String newPal)
    {          
        pal = newPal.toUpperCase();         
    }

    public void setPal(String initPalin)
    {
       pal = initPalin.toUpperCase();           
    }

    public String getPal()
    {
       return pal;
    }

    public boolean isPalindrome()
    {
       int left = 0;
        int right = pal.length() -1;

        while (pal.equals(toUpperCase))
        {
          if (pal.charAt(left) != pal.charAt(right));
             {
                 return false;
              }
              left++;
              right--;
        }
           return true;
        }

     public String toString()
     {
        return "Palindrome" + isPalindrome();
     }
}

Client Class

import java.util.Scanner;

    public class Palindromeclient
    {
      public static void main(String[]args)
      {             
          String pal;
          boolean isS = false;

          Scanner scan = new Scanner(System.in);

          System.out.println("Enter statement press[enter]:");
          String userinput = scan.nextLine();
          Palindrome statement = new Palindrome(pal);

          isS = statement.isPalindrome();

          if (isS)
              System.out.println(userinput + "is a palindrome");              
          else 
              System.out.println(userinput + "is not a palindrome");              
      }      
    }

My coding is giving me a

Palindrome.java:34: error: cannot find symbol
        while (pal.equals(toUpperCase))
                          ^
  symbol:   variable toUpperCase
  location: class Palindrome
1 error

I don’t get why though, can I simply add uppercase to the set or second constructor instead, which might be able to fix my service class.

That’s my question, number one

  • 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-01T04:21:19+00:00Added an answer on June 1, 2026 at 4:21 am

    Answer to question 1:

    toUpperCase is a method of the String and should be invoked as one.

    pal.toUpperCase()
    

    Just like you did in the setPal method.

    Answer to question 2:
    The boolean in the main method is not needed, because you could ask your Palindrome object if it is a palidrome directly in de System.out.

    statement.isPalindrome()
    

    Beware though, your program won’t work as you don’t pass the user input to the Palindrome Constructor.

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

Sidebar

Related Questions

Need to use own imaged markers instead built-in pins. I have several questions. 1.
I'm new here and I've searched for questions to help me but I have
I have several questions: 1. What's the difference between isoMDS and cmdscale? 2. May
I have several questions regarding filenames and the iPod Library. I understand I can
I have several questions concerning the controls like a button, if You could answer
I have several questions about properties displayed in propertyGrid i cant seem to find
I thought about migrating subversion a lot and I have several questions still open.
I have a program shown as follows. For it I have several questions: 1).
There have been several questions already posted with specific questions about dependency injection ,
There have been several questions recently about database indexing and clustered indexing and it

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.