scanner clas

M

memocan

hi,

I want to use the scanner class for user I/O and I am
using Eclipse. But the when I import java.util.* , eclipse
doesnt recognize the scanner class. Can you please specifically
tell me what I should download and could you also give a direct
link which will get me use the scanner class??

Thanks,
mehmet
 
E

Eric Jacoboni

I want to use the scanner class for user I/O and I am
using Eclipse. But the when I import java.util.* , eclipse
doesnt recognize the scanner class.

java.util.Scanner class comes with Java 5.0 : you cannot use it with
previous SDK.
Can you please specifically
tell me what I should download and could you also give a direct
link which will get me use the scanner class??

I think that "Scanner class" in Google will give you all the answers
you need.

Here's a simple example:

import java.util.Scanner;

public class TestScanner {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.printf("Message : ");
String mess = scanner.nextLine();
System.out.printf("You wrote %s%n", mess);
}
}
 
T

Thomas Fritsch

I want to use the scanner class for user I/O and I am
using Eclipse. But the when I import java.util.* , eclipse
doesnt recognize the scanner class.
Class java.util.Scanner is available since Java 1.5.
I suspect that your Eclipse project is configured to have an older Java (1.4
for example).
Can you please specifically
tell me what I should download and could you also give a direct
link which will get me use the scanner class??
To change it: open the "Properties" dialog for your project, select "Java
Build Path" - "Library" - "Edit", select an JRE 1.5 (may be you'll have to
add the JRE 1.5 first)
 
R

Roedy Green

hi,

I want to use the scanner class for user I/O and I am
using Eclipse. But the when I import java.util.* , eclipse
doesnt recognize the scanner class. Can you please specifically
tell me what I should download and could you also give a direct
link which will get me use the scanner class??

Thanks,
mehmet

You would import java.util.Scanner;
not scanner.
 
M

mehmet canayaz

Hi again,

I updated my jre to 1.5 and eclipse doesn't give error messages for the
scanner class now.
But when I try to run it as an application, I am getting these kinda
messages

java.lang.NoClassDefFoundError: jre1/5/0_05
Exception in thread "main"

no matter which application I try to run.

now what :) ??

thanks for your answer

mehmet canayaz
 
M

mehmet canayaz

Everything is OK now, I just reinstalled Eclipse and it works
perfectly,

thanks again,

mehmet canayaz
 
C

ChrisWSU

That error is more then likely to occur when you have your run settings
screwed up, where its not actually tring run the right thing. Ive seen
that a lot...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top