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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:00:58+00:00 2026-06-06T03:00:58+00:00

Possible Duplicate: Programming java to determine a symmetrical word am new here, but I

  • 0

Possible Duplicate:
Programming java to determine a symmetrical word

am new here, but I am having hard time figuring out how to write a code to determine an input of word and see if the first is matching with the end of the word. You may input abba and get answer it’s evenly symmetric and aba is oddly symmetric.

Please show me how:(

Just two main things.

first I want to know if it’s oddly or evenly amount of letter(number of letter divided by 2,if it’s ending with 0.5, it’s oddly symmetric, if is an integer it’s evenly symmetric.

second I want to get (i.e 1=n,2=n-1,3=n-2…) position of the letter in the word to be the main idea of the execution.If there is a last letter in the oddly symmetric word, ignore the last remaining letter.

I appreciate any headstart or idea:) Thanks!

Thanks KDiTraglia, I made the code and compiled and here is what I put. I am not getting any further.

Reported problem:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: reverse cannot be resolved or is not a field reverse cannot be resolved or is not a field Syntax error, insert ") Statement" to complete IfStatement

This is what i got from, KDiTraglia’s help

    public class WordSymmetric {
public static void main(String[] args) {
 String word = "abccdccba";


if ( (word.length() % 2) == 1 ) {
    System.out.println("They are oddly symmetric");
    //odd
}
else {
    System.out.println("They are evenly symmetric");
    //even
}

int halfLength = word.length() / 2;
String firstHalf = word.substring(0, halfLength);
String secondHalf = word.substring(halfLength, word.length());

System.out.println(secondHalf.reverse());

if (firstHalf.equals(secondHalf.reverse()) {
    System.out.println("They match");
    //they match
} 
} }
  • 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-06T03:00:59+00:00Added an answer on June 6, 2026 at 3:00 am

    The reverse() approach is very clean and readable. Unfortunately there is no reverse() method for Strings. So you would either have to take an external library (StringUtils from the appache common lang3 library has a reverse method) or code it yourself.

    public static String reverse(String inputString) {
      StringBuilder reverseString = new StringBuilder();
      for(int i = inputString.length(); i > 0; --i) {
        char result = inputString.charAt(i-1);
        reverseString.append(result);
      }
      return reverseString.toString();
    }
    

    (This only works for characters that can fit into a char. So if you need something more general, you would have to expand it.)

    Then you can just have a method like this:

    enum ePalindromResult { NO_PALINDROM, PALINDROM_ODD, PALINDROM_EVEN };
    public static ePalindromResult checkForPalindrom(String inputStr) {
      // this uses the org.apache.commons.lang3.StringUtils class: 
      if (inputStr.equals(StringUtils.reverse(inputStr)) {
        if (inputStr.length % 2 == 0) return PALINDROM_EVEN;
        else return PALINDROM_ODD;
      } else return NO_PALINDROM;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is your longest-held programming assumption that turned out to be incorrect?
Possible Duplicate: C# Captured Variable In Loop I am pretty new to multi-threading programming.
Possible Duplicate: Cross platform programming I've written some code using wxwidgets in c++. But
Possible Duplicate: Exception in thread “main” java.lang.NoSuchMethodError: main I am fairly new to Java,
Possible Duplicate: Tips for an iOS developer to learn Mac programming? After having spent
Possible Duplicate: Similarity Between Colors I know it's not a programming question but I
Possible Duplicate: Functional programming: currying I'm reading the free F# Wikibook here: http://en.wikibooks.org/wiki/F_Sharp_Programming There's
Possible Duplicate: What do people find difficult about C pointers? New to c programming
Possible Duplicate: Tween library for AS3 I have been out of ActionScript programming for
Possible Duplicate: C++ beginner, execution window disappears quickly I am beginner at C programming.

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.