Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2011
    Location
    Norfolk, VA
    Posts
    19
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Help compiling a simple class (Solved)

    Hi I am currently learning java so I can develop android apps, but I just started so I need a little guidance as the books and tutorials I am using aren't perfect.
    Code:
    // I had forgotten to add 
    //import.util.Scanner
    
    class EchoLine {
    	public static void main(String args[]) {
    		
    		Scanner eyeGlass = new Scanner(System.in); //This is Line 5
    		System.out.println(eyeGlass.nextLine());
    	}
    }
    For some reason I can't get this to compile, Jcreator is showing.

    error: cannot find symbol line 5

    #Solved

    I forgot to use import java.util.Scanner, I can't believe i missed that it's like trying to use a gun with no bullets of course I'm gonna fail.
    Last edited by syronix; 10-21-2011 at 08:45 PM. Reason: Got ahead of myself (Solved)

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Assuming that everything works the same as standard Java, I'd expect all you need is to import java.util.Scanner. Does the error not indicate on what symbol its failing?

  • Users who have thanked Fou-Lu for this post:

    syronix (10-21-2011)

  • #3
    New Coder
    Join Date
    Oct 2011
    Location
    Norfolk, VA
    Posts
    19
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Assuming that everything works the same as standard Java, I'd expect all you need is to import java.util.Scanner. Does the error not indicate on what symbol its failing?
    You're absolutely correct and sorry I didn't update sooner to let everyone know I had found my little mistake, thanks for responding so quickly though.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •