Hello, I am trying to figure out what I need to do here to get this program to accept simple char input. Please excuse the syntax as it is just a rough draft. I know I am missing another important component but can't figure out what it is. Any help is greatly appreciated.
Why don't you use input.next() to return String and you can do String comparison using equals(). If you insist on using character, you can use input.next().charAt(0) to get the character and use == operator to do the comparison.
Does this help you?
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
C:\Documents and Settings\tank\java>javac AgeTest.java AgeTest.java:10: cannot find symbol symbol : variable input location: class AgeTest age = input.nextInt(); ^ AgeTest.java:14: cannot find symbol symbol : variable input location: class AgeTest topic = input.next(",").charAt(0); ^ 2 errors
I am just trying to write a simple multiple choice program. Trying to figure out just how to get the results after pressing a, b, c,. b = write answer a & c = wrong answers. Looking for the best way to accomplish this. I can't find anywhere online that just simply shows how to do this. If anyone knows where I can find a simple way of doing this I would really appreciate it.
Originally posted by Mark Adams: Yes I did, do I need that?
Yes. If you look at the error message it is complaining that the variable 'input' is not defined. That line defined it. Add that line and I think your program should work. It will at least compile. We can then sort out any logic errors.