Jump to content


Scanner Issues


  • Please log in to reply
2 replies to this topic

#1 Splinter

Splinter

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 10 July 2011 - 03:06 PM

Hello,

I am trying to just use the simple scanner for java and I'll import my code so you can see how I am trying to use it right now.  I am getting an error when it comes to System.in on the build output and I am not sure why.  Thank you in advance, also posting the general output below the code.
import java.util.Scanner;
public class OddEven {
	
	public static void main(String[] args) {
		
		Scanner input = new Scanner(System,in);
		int number;
		System.out.print("Enter Your Number");
		number = input.nextInt();
		System.out.println(number);
	}
}
java.lang.NoClassDefFoundError: OddEven
Caused by: java.lang.ClassNotFoundException: OddEven
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: OddEven.  Program will exit.
Exception in thread "main" 
Process completed.


#2 Kraicheck

Kraicheck

    Advanced Member

  • Members
  • PipPipPip
  • 884 posts
  • Gender:Male
  • Location:Belgium

Posted 15 July 2011 - 10:46 AM

You've written a comma instead of a point for System.in.
Please check your code for stupid mistakes like this before asking for help.

#3 Blackiey

Blackiey

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 21 November 2011 - 04:16 AM

 Kraicheck, on 15 July 2011 - 10:46 AM, said:

You've written a comma instead of a point for System.in.
Please check your code for stupid mistakes like this before asking for help.

This is a "Beginners" Forum, time it is hard for a beginner to see easy issue as we do.