1

I am trying to run a java file in the command prompt. the project was made in NetBeans. so I tried running it with java -jar "D:\Java Projects\Algo1\dist\Algo1.jar" which is what NetBeans told me to run in the command prompt. however, I get the following: my errors in cmd

my code is: `

public static void main(String[] args) {
        // TODO code application logic here
        Scanner N = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        Scanner K = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        Scanner L = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

        System.out.println(K);
    }

1 Answers1

2

When you call System.out.println(K), java will print the argument (K) to the console. In this case the output tells you that you have an instance of the class java.util.Scanner and its properties.

When you want to read an input from the console, you should use the nextLine() method from the Scanner class, for example

String input = K.nextLine();

You can read more here: https://stackoverflow.com/a/11871792/7677308

Community
  • 1
  • 1
SilverNak
  • 3,017
  • 4
  • 24
  • 33