Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Need help-SavitchIn problem

Options
  • 06-07-2004 6:10pm
    #1
    Closed Accounts Posts: 1,959 ✭✭✭


    Hi all,
    I'm writing a program (Java) that requires I/O. Basically I've declared and initialised two doubles, num1 and num2. The user has to enter two doubles, then I have to set them to num1 and num2 respectively. I got SavitchIn off the net, saved it and compiled it, so i could use it in my program but I get error messages. For both lines where I used SavitchIn, it says "cannot resolve symbol".
    I tried using import java.util.*; but that didn't work either.
    I noticed when I saved SavitchIn, only SavitchIn.java was saved, not SavitchIn.class.

    Any ideas?
    Thanks.


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Read the manual? You don't need a third class app to get user input.

    BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    
    String message = stdin.readLine();
    

    As for when it was saved. You mean compiled? Have you done that?


  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    Sounds like a classpath error when your compiling your own program.

    The reason you're seeing the erroris that javac can't see the Savitchin class, you need to tell it where it is.
    javac -classpath ./Savitchin YourClass.java
    

    You're better off really just doing what Hobbes said though.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    The way your post reads it sounds like a class project.

    You won't get points for ripping a third party class/app to do the work, and you will be kidding yourself in the long run when you actually need to code this sort of thing.

    You would be better off writing it using the normal java commands. The sample above will give you the input, you can just use wrapper classes (eg. Double) to verify what is entered is correct.


  • Closed Accounts Posts: 1,959 ✭✭✭Nala


    Originally posted by Hobbes
    Read the manual? You don't need a third class app to get user input.


    BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    
    String message = stdin.readLine();
    

    As for when it was saved. You mean compiled? Have you done that?

    I did compile it yeah. It is a class project aswell btw.


Advertisement