aspose file tools*
The moose likes Beginning Java and the fly likes Same old problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Same old problems" Watch "Same old problems" New topic
Author

Same old problems

Dwayne Loving
Greenhorn

Joined: May 22, 2005
Posts: 9
Seems like I can't escape the problem of having 1 or 2 errors when I compile my prgram. Here's what I have:
public class calculateFunction
{
public int calculateValue (int x)
{

int y=0
y=(int)(x+(x*x) + Math.pow(2,x));
return y;
}

public void printStars ()
{
for (int j; j < 10; ++j)
{

int y = calculateValue(j);
y/=10;
System.out.println("PrintFor: +j");
for (int I=0;i<y;i++)
System.out.print("*");
System.out.println ("\n\n");
}
}

public static void main (String[] args)
{
calculateFunction cal = new calculateFunction ();
Cal.printStars();
}
}
The error message I receive is:




any ideas as to why this error continously comes up?

Thanks,
Dwayne
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

The semicolon ( that belongs at the end of the previous line is missing.


[Jess in Action][AskingGoodQuestions]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
For future reference, Sun's compiler shows a caret (^) underneath the line of code to indicate where it encountered a problem. Sometimes the actual cause of the error is before this. In this case, as EFH pointed out, the missing semicolon that the error message is complaining about should go on the previous line.

Get used to having error messages the first time you compile a program. I am willing to bet that most programmers see them often. The trick is to learn what the error message means so it can help you find the problem and fix it. In this case, the moral of the story is that you should look at the lines above where the actual error occurs.

HTH

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Same old problems