我正在尝试编译一个程序,但我不断收到一些以前从未见过的错误。这是我的程序:
import java.util.Scanner;
import java.io.FileReader;
import java.io.*;
public class Project1
{
public static void main (String [] args) throws FileNotFoundException
{
Scanner inFile = new Scanner(new FileReader("artists.txt") ); //read from file
Scanner console new Scanner(System.in); //read from user input
int sum = 0; //sum of revenue
String artist; //user input
int revenue = 0; //store yearly revenue
System.out.println("Please enter the name of a band/artist: ");
artist = console.next();
String[] tokens = artist.split(" ");
while(inFile.hasNext() )
{
if (tokens == inFile.hasNext() )
{
if (inFile.Next == (2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012) );
{
if (inFile.hasNext() )
{
revenue = inFile.nextInt();
sum += revenue;
System.out.print("sum");
}
}
}
}
inFile.close();
我得到的错误如下:
Error: Syntax error, insert ";" to complete LocalVariableDeclarationStatement [Line 13]
Error: Syntax error on token "==", Name expected after this token [Line 30]
如果有人碰巧看到任何其他错误,请随时指出。谢谢你。