wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes User Input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Input" Watch "User Input" New topic

User Input

John Murray

Joined: Jun 28, 2007
Posts: 3
Hi all, I'm new to java and I found this site as a great resource among other. Right now I'm having some money troubles so I havent had a chance to go out and get a book to buy or buy driving to the library (might be a good thing to just ride my bike and do.) anyways I'm having a bit of toruble working on a new project. The program takes a number the user inputs in the cmd line and prints the square of it, easy enough right? Well it seems I'm having trouble compiling this with netbeans IDE 5.5.1

Here is the source of the origional

here is the compile log

Created dir: C:\Java\testing2\build\classes
Compiling 1 source file to C:\Java\testing2\build\classes
C:\Java\testing2\src\testing2\Main.java:15: cannot find symbol
symbol : variable TextIO
location: class Square
userInput = TextIO.getInt();
1 error
BUILD FAILED (total time: 1 second)

However the tutorial on this required that I use a file for the TextIO class, how would I go about doing this without that?

Thanks for any help

[ June 28, 2007: Message edited by: John Murray ]
[ June 28, 2007: Message edited by: John Murray ]
David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212
Did you import the TextIO class or put it in your path? The compiler needs to know where to find TextIO. You could just put it in the same folder as the class you are writing, I am not sure that is the best solution, but it is certainly the easiest.

Where did you get that class? Is it just a wrapper for standard Java IO classes? If it is, I recommend using the standard IO classes from the beginning. These kinds of classes aren't really hiding a whole lot. They are just getting you used to using a non-standard class. Just my opinion. BufferedReader or Scanner should do what you need.
[ June 28, 2007: Message edited by: David McCombs ]

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
John Murray

Joined: Jun 28, 2007
Posts: 3
NVM had to import class from a diff file from a tutorial(that is why I should just be slapped with a trout), what I meant was how could I get the users input as an integer.
[ June 28, 2007: Message edited by: John Murray ]
David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212


Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

There are some good java tutorials right on the sun java websire

===Vyas Sanzgiri===
My Blog
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

John Murray

Joined: Jun 28, 2007
Posts: 3
Not gunna lie to you, I'm pretty well lost reading all of that between the two links. I fell pretty dumb right now I'm going to go spend some time researching a few words I don't understand in the links. I feel like I can see the bottom of the lake but when I jump in it's actually alot deeper, Might be a fun lake to swim in for awhile though
[ June 28, 2007: Message edited by: John Murray ]
dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
well!!here comes your answer try the code below you will get user input as integer...

import java.io.BufferedReader;
import java.io.InputStreamReader;

i hope this program gives you the output as square.........
jQuery in Action, 2nd edition
subject: User Input
Similar Threads
help needed with my while loop
Need help with boolean search with 2d array
Array Project Help
Scanner class
cannot find symbol inside String?