Java Keyboard Reader: V1.3 to Newest Version

  • Context: Java 
  • Thread starter Thread starter thharrimw
  • Start date Start date
  • Tags Tags
    Java
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
7 replies · 3K views
thharrimw
Messages
114
Reaction score
0
I have recently started to try to teach myself java and i can't get the keybord reader to work.
I'm a book thet's for java V1.3 but I'm using the newest version is that the problem? unless the book was wong then my program syntax should be fine. could anyone tell me what the syntax for the keybord reader is?
 
Physics news on Phys.org
BufferedReader in
= new BufferedReader(new InputStreamReader(System.in));

I believe this is what you need. Are you planning to run your program using the cmd or gui?
 
cmd it's just a basic temp. converting program. I'm not used to jave I've only programmed on my ti 83+, 89T, and Nspier
 
if i copy and past my program could you show me what's wrong? the book that i have is fron 2004 so i don't know if it's syntax is out of date or not.
 
Sure...you could copy and paste it here. I take a look at it. See what's up.

FYI: I'm a intermediate java and c++ programmer.
 
ImputTerminalIO.KeyboardReader
public class converter {
public static void main(String [] args) {
KeyboardReader reader = new KeyboardReader();
double f;
double c;

System.out.print("enter F: ");
f =reader.readDouble();

c = (f-32.0)*5.0/9.0;

System.out.println("The equivalent in c is ");

reader.pause();
}
}
 
that's exactly as it was in my java book.
 
You need to tell us EXACTLY what's happening -- what error messages you're seeing, etc. -- not just "I can't get it to work."

The "KeyboardReader" is not a standard part of the Java programming language. If the KeyboardReader was provided in your book, you need to also type that into a file called "KeyboardReader.java" and compile it along with your own program.

- Warren