The method doesn't not support a string argument.
http://docs.oracle.com/javase/8/docs/api...
import java.io.*;
import java.util.*;
public class Tester{
public static void main( String args[] )
{
Scanner kbReader = new Scanner(System.in);
System.out.print("One Two");
String s = kbReader.next();
System.out.println("This is the first part of the String: " + s);
s = kbReader.next();
System.out.println("This is the next part of the String: " + s);
}
}
I was typing an example code from my packet for computer science class and I got some sort of error. I don't know what I did wrong, I entered exactly what was on the packet.
Heres the code:
import java.io.*;
import java.util.*;
public class Tester{
public static void main( String args[] )
{
Scanner kbReader = new Scanner(System.in);
System.out.print("One Two");
String s = kbReader.next("s");
System.out.println("This is the first part of the String,..." + s);
s = kbReader.next("s");
System.out.println("This is the next part of the String," + s);
}
}
Heres the error:
One TwoException in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:907)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.next(Scanner.java:1463)
at Tester.main(Tester.java:8)