waltbaby315
asked on
cant get program to complile
cant get program to complile, what is im doing wrong?
import java.util.*;
public class palindrome
{
public static void main(String args[]) throws IOException
{
int palindrome_number=0;
System.out.println("Please input a 5-digit number");
BufferedReader input = new BufferedReader(new InputStreamReader(System.i n));
String line = input.readLine();
boolean palindrome = line.equalsIgnoreCase(new StringBuffer(line).reverse ().toStrin g());
if (palindrome)
{
System.out.println("it is a palindrome");
}
else
{
System.out.println("it is not a palindrome");
}
}
error2.JPG
import java.util.*;
public class palindrome
{
public static void main(String args[]) throws IOException
{
int palindrome_number=0;
System.out.println("Please
BufferedReader input = new BufferedReader(new InputStreamReader(System.i
String line = input.readLine();
boolean palindrome = line.equalsIgnoreCase(new StringBuffer(line).reverse
if (palindrome)
{
System.out.println("it is a palindrome");
}
else
{
System.out.println("it is not a palindrome");
}
}
error2.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, you need to add one "}" to close the class itself.
you missed one } which started at public class {
The class itself needs to be closed off.
Sometimes by using indenting at each brace point you will find it easier to detect issues such as this.
Generally when you get an error message that says reached end of file prematurely it means that a syntactic element has been started, but no matching ending element has been discovered.
Sometimes by using indenting at each brace point you will find it easier to detect issues such as this.
Generally when you get an error message that says reached end of file prematurely it means that a syntactic element has been started, but no matching ending element has been discovered.
Open in new window