Results 1 to 4 of 4
Thread: 2 errors with Scanner , help
- 01-24-2009, 09:48 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 3
- Rep Power
- 0
2 errors with Scanner , help
hi,
im anew member >> can u help me please
i have 2 errors with this code
Java Code:public class wordlength { public wordlength() { } public static void main(String[] args) { // the errors are in the next line Scanner stdin = Scanner.create (System.in); System.out.print("Enter Word"); String word = stdin.nextline(); int wordlength = word.length(); System.out.println("word"+word+"has length"+wordlength+"."); }}
-
double posted
- 01-25-2009, 03:14 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
I would suggest importing the Scanner class, like this.
import java.util.Scanner;
then have your class declarations, but before you try and get info from the user, you have to go like this:
Scanner asdf = new Scanner (Sytem.in);
- 01-25-2009, 04:03 AM #4
Similar Threads
-
makeButton errors
By ljk8950 in forum AWT / SwingReplies: 12Last Post: 08-10-2008, 02:10 AM -
Java Errors! Please help!
By TearsOfTheMoon in forum New To JavaReplies: 2Last Post: 06-10-2008, 10:00 AM -
help with these errors
By oceansdepth in forum New To JavaReplies: 3Last Post: 04-16-2008, 05:55 PM -
Errors I don't understand
By MattyB in forum New To JavaReplies: 4Last Post: 04-02-2008, 12:55 AM -
Errors in constructor
By ai_2007 in forum Advanced JavaReplies: 0Last Post: 07-01-2007, 06:35 PM
Bookmarks