0

I have been working on this code for a total of 6 days, I have be trying find ways to implement the user to enter an integer 5 times then reverese those number and determine wheter this is a palindrome or not. Also not the my public static boolean isPalindrome is preventing me from compiling

import java.util.Scanner;

public class Palindrome{
	/**Main Method */
	public static void main(String[] args)
	{
		//Create  a scanner
		Scanner readinput = new Scanner(System.in);
		// Introduce program
		System.out.print(" This is a Palindrome excercise: ");
		//Prompt user to enter an integer
		System.out.print("Enter 5 integer: ");
		int number = readinput.nextInt();
		int n=number;
		int rev =0;
		int j = isPalindrome(n);
		 System.out.println("Integer: ");
        System.out.println(" "+ num);
		for (int i=0; i<=num; i++, j++){
          int r=num%10;
          num=num/10;
          rev=rev*10+r;
          i=0;
		  }
		 System.out.println("The number entered is now reversed: "+ " ");
        System.out.println(" "+ rev); 
		public static boolean isPalindrome
        if(n == rev){
        System.out.print("The integers entered are Palindromes, True!");
        }
        else{
        System.out.println("The intergers entered are not palindromes, False!");
       }
    } 
 }

Edited by juice33: n/a

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by JamesCherrill
0

preventing me from compiling

IF you are getting errors, please copy the full text of the error message and paste it here.

0

You try to define isBoolean inside the main(...) method - probably because you are missing a } to close the definition of main.
However, unless you correct the indentation, it's hard to see clearly.

0

You try to define isBoolean inside the main(...) method - probably because you are missing a } to close the definition of main.
However, unless you correct the indentation, it's hard to see clearly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.