unreachable statement

Hi there everyone. I have coded a problem in order to solve this question

What is the smallest int x > 2006 so that x^7 and x terminate in teh same five digits?

When I compile this program, I get the following error

C:\Documents and Settings\7531student\Desktop\Number21.java:41: unreachable statement

System.out.println("The Number is: " + x);

^

1 error

Process completed.

import java.lang.Math;

publicclass Number21

{

publicstaticvoid main (String[] args)

{

int answer;

int x = 9999;

long xtemp;

String xStr ="";

String xtempStr ="";

boolean found =false;

while (!false)

{

int lengthX;

int lengthXTemp;

String subX ="";

String subXTemp ="";

xtemp = (long)Math.pow(x,7);

xStr = String.valueOf(x);

xtempStr = String.valueOf(xtemp);

lengthX = xStr.length();

lengthXTemp = xtempStr.length();

subX = xStr.substring((lengthX-5),(lengthX-1));

subXTemp = xtempStr.substring((lengthXTemp-5),(lengthXTemp-1));

if(subX.equals(subXTemp))

{

answer = x;

found =true;

}

x++;

}

System.out.println("The Number is: " + x);

}

}

[2209 byte] By [NoneBoy123a] at [2007-10-3 8:19:45]
# 1

while (!false)

I think you mean found instead of false.

When you use "while not false" the compiler sees "while true" and sees no break statement so it knows that the loop will never end, so the System.out line will never be reached.

atmguya at 2007-7-15 3:25:19 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...