• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Same old problems

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The semicolon ( that belongs at the end of the previous line is missing.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic