Reputation: 43
import java.util.Scanner;
public class JavaApplication1 {
public static void main (String[] args)
{
System.out.println ("You will be prompted to enter the lengths of your triangle, do this in no particular order");
*Scanner sc = new.Scanner(System.in);
}
}
Why am I getting an error on the marked Scanner
line? I've done this countless times. It keeps telling me it needs an identifier. What's going on?
Upvotes: 1
Views: 68
Reputation: 43
I had made a simple error. The corrected code is:
import java.util.Scanner;
public class JavaApplication1 {
public static void main (String[] args)
{
System.out.println ("You will be prompted to enter the lengths of your triangle, do this in no particular order");
Scanner sc = new Scanner(System.in);
}
Upvotes: 0
Reputation: 35567
It should be
Scanner sc = new Scanner(System.in);
Not
Scanner sc = new.Scanner(System.in); // . is invalid
.
should replace with a space. there is no *
aswell
Upvotes: 1