• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Same old problems

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic