I am starting a project to read a file of student grades and do some calculations on that information. But I cannot even manage to find syntax that would allow for the user to input a file name. I found this example but it throws an error.
class main
{
static void main(args)
{
print ("Enter the name of the file: ");
def fileName = System.console().readLine;
println(fileName);
}
}
As @cfrick is already mentioned in the comment,
readLine
is a function/method (you need to call it properlyreadLine()
) Here is the working code:You may read more about calling Groovy methods here.