Win a copy of Spring Boot in Practice this week in the Spring forum!

Robert Oliver

+ Follow
since Jun 25, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert Oliver

Thanks Mark. Worked great. Simple and straight forward.
19 years ago
I am trying to figure out how to read a text file and read it into a text area in my program. This should be fairly straight forward but I can't seem to get anything to work.
This doesn't work and I have tried several variations.

File filename = jfc.getSelectedFile();
try{// opens try
FileReader in = new FileReader(filename);
BufferedReader br =
new BufferedReader(in);
int c;
String s =;
while ((c = != -1)
comments.append("\n" + s +"\n");
}// closes try

19 years ago
Thanks for the reassurance, Dan. It was actually your Topic test question 5 on Flow control that asked what 'd' - 'a' was that prompted me to ask the question. Obviously you don't have to know what the ascii value of 'd' or 'a' just that they are sequential and 'd' is three more than 'a'. I have not seen anything either in the objects.
Bani, Sorry to mislead you. I don't have any secret for Unicode. I only meant the relationship of Unicode, Hex to using the same codes 0-F.
For example here is a change to my code one line add's a hex value and one line adds a unicode.

Output is
0x1f + 1 = 32
\u001f + 1 = 32
[ July 30, 2002: Message edited by: Robert Oliver ]
[ July 30, 2002: Message edited by: Robert Oliver ]
For the exam will I need to know what the value of char primitives? I have seen on a few mock exams questions that ask what will be printed when add characters to intergers. Here's my example.

Output is
1 + 1 = 50
Now I know tricks to remeber Unicode and Hex but not Ascii values.
Okay I understand why s1 == s2 returns false. But why does (s1.equals(s2)) return true??? Is s1 a Sting object? Is a String literal an object.
Also if
String s3 = "abcd"
(s1 == s3) returns true and
(s1.equals(s2)) returns true?
I know this to be true but cannot explain it.