Skip to main content

reached end of file while parsing. need help

1 reply [Last post]
d2008
Offline
Joined: 2009-05-17
Points: 0

import java.util.Scanner;

public class SawTooth {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Number of teeth: ");
int nbTeeth = input.nextInt();

System.out.print("Width of each tooth: ");
int toothWidth = input.nextInt();

for(int i=0;i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jesdisciple
Offline
Joined: 2008-05-01
Points: 0

That last bracket is part of the file, right? I think it is, but I want to make sure it's not stray. (FYI, the forum has a [ code ] tag not shown in the editor, although I wish it had line numbers.)

The only other thing I can think of is that the characters might be corrupted in a way that tricks the compiler. (I've seen that problem in PHP, dunno whether Java has it.) But since the error [i]is[/i] on the last line, that's improbable.

I hope someone else can be more helpful; I haven't touched Java in a while. I'm only subscribed to this forum because it needs all the community it can get.

[code]import java.util.Scanner;

public class SawTooth {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Number of teeth: ");
int nbTeeth = input.nextInt();

System.out.print("Width of each tooth: ");
int toothWidth = input.nextInt();

for(int i=0;i for(int j=1;j<=toothWidth;j++) {
String line = "";
for(int k=0;k line += "s";
}
System.out.println(line);
}
}
}
}[/code]