The Entrepreneur Forum | Financial Freedom | Starting a Business | Motivation | Money | Success
  • SPONSORED: GiganticWebsites.com: We Build Sites with THOUSANDS of Unique and Genuinely Useful Articles

    30% to 50% Fastlane-exclusive discounts on WordPress-powered websites with everything included: WordPress setup, design, keyword research, article creation and article publishing. Click HERE to claim.

Welcome to the only entrepreneur forum dedicated to building life-changing wealth.

Build a Fastlane business. Earn real financial freedom. Join free.

Join over 90,000 entrepreneurs who have rejected the paradigm of mediocrity and said "NO!" to underpaid jobs, ascetic frugality, and suffocating savings rituals— learn how to build a Fastlane business that pays both freedom and lifestyle affluence.

Free registration at the forum removes this block.

While Compiling Getting an Error in Java

adisharma

PARKED
User Power
Value/Post Ratio
0% - New User
Jan 23, 2020
11
0
Gurgaon
Hello Everyone, I am facing an error while executing the below program. Can anyone help me out?

Java:
EyeColour.java:27: error: cannot find symbol
    Scanner input = scanner(System.in);
                    ^
  symbol:   method scanner(InputStream)
  location: class EyeColour
1 error

I keep getting this ^^ error when trying to compile the following code on Interviewbit. I'm new to Java and I can't find a solution online, sorry if the solution is really obvious:

Java:
import java.util.Scanner;
class EyeColour //
{
    public static void main (String[] param)
    {

        InputEye();
        System.exit(0);

     } // END main


    public static void InputEye() 
    {
        Scanner scanner = Scanner(System.in);
        System.out.println("What is your eye colour?");
        String EyeColour;
        EyeColour = scanner.nextLine();
        System.out.println("So your eyes are " + EyeColour + " are they? I like " + EyeColour);
        return;

    } // END InputEye 



} // END class EyeColour

Any Suggestions?
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

mdot

Always Improve.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Speedway Pass
User Power
Value/Post Ratio
190%
Dec 24, 2020
245
465
Ontario, Canada
Hello Everyone, I am facing an error while executing the below program. Can anyone help me out?

Java:
EyeColour.java:27: error: cannot find symbol
    Scanner input = scanner(System.in);
                    ^
  symbol:   method scanner(InputStream)
  location: class EyeColour
1 error

I keep getting this ^^ error when trying to compile the following code on Interviewbit. I'm new to Java and I can't find a solution online, sorry if the solution is really obvious:

Java:
import java.util.Scanner;
class EyeColour //
{
    public static void main (String[] param)
    {

        InputEye();
        System.exit(0);

     } // END main


    public static void InputEye()
    {
        Scanner scanner = Scanner(System.in);
        System.out.println("What is your eye colour?");
        String EyeColour;
        EyeColour = scanner.nextLine();
        System.out.println("So your eyes are " + EyeColour + " are they? I like " + EyeColour);
        return;

    } // END InputEye



} // END class EyeColour

Any Suggestions?
This isn't a programming forum, but I'll give you a hint - take a closer look at the line of your code that doesn't compile in the example program code. What you wrote isn't the same (and it's not because of the variable name).
Edit: I misinterpreted the question and apparently have forgotten how Java works LOL
 
Last edited:

Ocean Man

Life-long learner.
Read Rat-Race Escape!
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
222%
Sep 26, 2018
902
1,999
United States
Hello Everyone, I am facing an error while executing the below program. Can anyone help me out?

Java:
EyeColour.java:27: error: cannot find symbol
    Scanner input = scanner(System.in);
                    ^
  symbol:   method scanner(InputStream)
  location: class EyeColour
1 error

I keep getting this ^^ error when trying to compile the following code on Interviewbit. I'm new to Java and I can't find a solution online, sorry if the solution is really obvious:

Java:
import java.util.Scanner;
class EyeColour //
{
    public static void main (String[] param)
    {

        InputEye();
        System.exit(0);

     } // END main


    public static void InputEye()
    {
        Scanner scanner = Scanner(System.in);
        System.out.println("What is your eye colour?");
        String EyeColour;
        EyeColour = scanner.nextLine();
        System.out.println("So your eyes are " + EyeColour + " are they? I like " + EyeColour);
        return;

    } // END InputEye



} // END class EyeColour

Any Suggestions?
I'm not sure if you figured out the answer, but I believe you forgot to initialize the scanner by calling the new keyword.
 

ff20

PARKED
Read Unscripted!
User Power
Value/Post Ratio
0% - New User
Dec 2, 2021
2
0
Hello Everyone, I am facing an error while executing the below program. Can anyone help me out?

Java:
EyeColour.java:27: error: cannot find symbol
    Scanner input = scanner(System.in);
                    ^
  symbol:   method scanner(InputStream)
  location: class EyeColour
1 error

I keep getting this ^^ error when trying to compile the following code on Interviewbit. I'm new to Java and I can't find a solution online, sorry if the solution is really obvious:

Java:
import java.util.Scanner;
class EyeColour //
{
    public static void main (String[] param)
    {

        InputEye();
        System.exit(0);

     } // END main


    public static void InputEye()
    {
        Scanner scanner = Scanner(System.in);
        System.out.println("What is your eye colour?");
        String EyeColour;
        EyeColour = scanner.nextLine();
        System.out.println("So your eyes are " + EyeColour + " are they? I like " + EyeColour);
        return;

    } // END InputEye



} // END class EyeColour

Any Suggestions?

1. For programming questions, you will get much better results if you post on forums like Stackoverflow. But, I strongly suggest that you follow #2 before you post.
2. If you want a great response, you should read this thread and this thread.
3. Always go to the documentation. It may solve your problem.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.
Last edited:

Post New Topic

Please SEARCH before posting.
Please select the BEST category.

Post new topic

Guest post submissions offered HERE.

New Topics

Fastlane Insiders

View the forum AD FREE.
Private, unindexed content
Detailed process/execution threads
Ideas needing execution, more!

Join Fastlane Insiders.

Top