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!");
       }
    } 
 }

Recommended Answers

All 3 Replies

preventing me from compiling

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.