My friend Harrison sent me a Java file that was giving him trouble. He wanted to read in an Integer from in a command-line program. He found the method readInt() in the class Console. But it wouldn’t compile:
for ( i = 0; i < 5; i++)
System.out.println(“Array["+ i +"] = “+ array[i]);
String name = null;
int age = 0;
age = Console.readInt(“Enter Age:”);
}
}
PersonTest.java:74: cannot find symbol
symbol : method readInt(java.lang.String)
location: class java.io.Console
age = console.readInt(“Int Enter Age:”);
^
1 errors
I did a little searching and found suggestions that he was going in the right direction:
char letter = Console.readChar("Enter a letter: ");
double d = Console.readDouble("Enter a real number: ");
int i = Console.readInt("Enter an integer: ");
String name = Console.readLine("Enter your full name: ");
http://faculty.cs.wwu.edu/martin/Software%20Packages/BreezyGUI/breezyguijavadoc/breezygui/console.html
hahaha! Turns out breezygui.console isn’t the same as console… the base language doesn’t actually have the readInt method, or readChar or readDouble. But apparently C# and or J++ and/or some dialect/library for C++ DO have a Console class with a readInt, readChar and readDouble members…
SO… you have to be VERY careful what the on-line document you’re counting on really says. It might have the method you want but only in a library you don’t have, or in another language completely. Ooof! is this fun or what???
Of course I showed Harrison how to get integer, double and char values he wanted. That’s what friends are for.
So be careful what you read and believe. Including this!

2 responses so far ↓
Harrison // July 2, 2009 at 5:14 pm |
Thanks Bill! So, St Thomas was right!! Seeing is not always believing! Touching or in our case, compiling is!:P
Bill Abbott // July 4, 2009 at 12:02 am |
Hi Harrison,
I think Smokey Robinson put it as, “Believe half of what wou see, some or none of what you hear…” no doubt this is biblically influenced.
happy 4th!
Bill