This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What' s wrong with this code?

 
Michael Burke
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.util.*;
class Numtest {
public static void main(String args[]) {
int answer;
for (int i=0; i<20; i++) {
answer=Math.abs(new Random().nextInt()%100)+1;
println(answer);
}
}
}
Here's the error message but I don't understand what the problem is. Thanks for any help.
C:\My Documents\Numtest.java:9: cannot resolve symbol
symbol : method println (int)
location: class Numtest
println(answer);
^
1 error
Tool completed with exit code 1
 
Roy Tock
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try System.out.println?
 
Michael Burke
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roy, it figures it was something obvious.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic