Current error message "cannot find symbol: variable nextLine in variable input of type Scanner"
Eventually it is going to do much more than this but I don't even understand why it won't read...so it may take a bit XD
Method so far:
public static void flipCoins(Scanner input)
{
ArrayList<String> lines = new ArrayList<>();
while(input.hasNextLine())
{
lines.add(input.nextLine);
// WHERE THE ERROR OCCURS
}
System.out.print(lines.toString());
}
These are the links I have been trying to debug with:
whole Scanner class: https://www.tutorialspoint.com/java/util/java_util_scanner.htm
.next() specifically: https://www.tutorialspoint.com/java/util/scanner_next.htm
EDIT FOR MORE
I also receive this error: "cannot find symbol: variable next in variable input of type Scanner", with the following:
lines.add(input.next);
you are missing parenthesis"()", nextLine() is a function when calling function in java we need parenthesis after a function name to invoke a function. similar to what you did here
while(input.hasNextLine())
this will work
public static void flipCoins(Scanner input)
{
ArrayList<String> lines = new ArrayList<>();
while(input.hasNextLine())
{
lines.add(input.nextLine());
}
System.out.print(lines.toString());
}