METEORITES
METEORITES

Reputation: 43

Scanner import issue apparently

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

Answers (2)

METEORITES
METEORITES

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

Ruchira Gayan Ranaweera
Ruchira Gayan Ranaweera

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

Related Questions