|
Computer Science (CSCI)
Department |
|||
|
|||
Input and Output
(Example code and figures from Computing Concepts with Java Essentials,
3rd edition, by Cay Horstmann.
Visit www.wiley.com/college/horstmann
for information on the current edition of this excellent text.)
double x = call to a method that reads a floating-point number;
or
double x = IO.readDouble(); // read user input
String str = "25"; int n = Integer.parseInt(str); |
String str = "" + n; |
String prompt = "How many nickles do you have?"; |
int count = Integer.parseInt(input); |
System.exit(0); |
public static void main(String[] args) throws IOException |
BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); |
String input = console.readLine(); |
|
Exercise - play with Input and Output in TextPad
|