fatooma92's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
2 (0 per day)
Joined:
19-February 12
Profile Views:
138
Last Active:
User is offline Apr 22 2012 05:18 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   fatooma92 has not set their status

Posts I've Made

  1. In Topic: palindromes with string methods

    Posted 22 Apr 2012

    How to do the main?
    Write a program that has an array of 5 Strings, and determines which ones are
    palindromes (letter-case does not matter) .
    Your code will be written in one class Palindrome.java and has a main() method.
    Please note the following:
    1. Do not write all your code in the main(). The main should only initialize the array, and
    print the palindrome words found. You can break your problem into smaller pieces
    dealt with in separate methods. For example you might need a method that determines
    whether a String is a palindrome or not (What would it take as a parameter? what
    would it return?)

    public class Palindrome
    {
      public static void main(String [] args) {
         String[] s = new String[5];
    (how to write this)
    
    }
       
       public static String Reverse(String x) {
            String hold = "";
            char [] c = x.toCharArray();
            for (int i = c.length-1; i>0; i--)
            hold = hold +c[i];
            return hold;
        }
        public static boolean pallindromCheck(String n) {
            String x=Reverse(n);
            if (x==n)
                return true;
            else
                return false;
            }
        
           
        
    }
    



    thanks...

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

fatooma92 hasn't added any friends yet.

Comments

fatooma92 has no profile comments yet. Why not say hello?