Carey Brown

+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
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
(keep public parts private until JForum day)
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Carey Brown

This is pretty much the only way to do it. You have to check for null first otherwise text.lenght() will throw a NullPointerException.
1 hour ago

Houna Naoui wrote:Could you explain please why the line 4 compile fine but the line 3 doesn't ?
why we can write int x = y<10 inside ternary expression(line 4) but we can't do the same for int t (line 3) ?
1. int y = 1;
2. int z = 1;
3. int t = z<10; // compile error
4. int x = y<10 ? y++ : z++; // compile fine
5. System.out.println(y+","+z);
6. System.out.println(x);// Outputs 2,1

The expression with the '<' operator results in a boolean value which cannot be assigned to an int.
The boolean result can be used as the condition part of a ternary expression that then determines which expression, y++ or x++, gets executed.
13 hours ago
That method just calls itself which means you'll probably get an out of memory exception. You need to call one of the methods in DriverManager.
Can you post the code that you're working with?
23 hours ago
I don't quite follow. That's exactly what the code I provided does.

My post directly above talks about the subtlety of matching a space before the word "flowered", you don't have a space before this word, you have a new-line.
23 hours ago
Notice that if you try to match on word boundaries

1 day ago
This worked for me.
1 day ago
(?m)Yellow .* daffodils\.
Ah, you have to enable multi-line mode with '(?m)'.
1 day ago
In MS Word it is a wild card expression, not a regular expression. With wild cards, to match any number of any character you use '*'. With regular expressions the period (.) denotes "any character", and the asterisk denotes "zero or more of". Together you get '.*' or "zero or more of any character.

Yellow .* daffodils\.
1 day ago
On the command line
javac *.java

And with all the .class files in the same directory you only have to run the file with main() in it and the JVM will find the other class files.
2 days ago
By adding these two methods  (sorry about the indentation) to Participant cleans up your other large block of code.
What if your 'participant' and 'participant2' refer to the same object?

I haven't run across mPoint.reset(line) before. What does reset() do? Javadocs were unhelpful.
The resulting modified string is not being used.

2 days ago
You are parsing the same CSV line twice. Why not parse once and make a list and from then on refer to the list.
2 days ago
Nit: st_length is really no longer a length but a position in a string.
3 days ago

Norm Radder wrote:The binary digits in the String should not be converted to int values.

Not sure I agree with this, converting to an int of 0 or 1 makes summing easier. Otherwise you have to handle all combinations of digit characters from str1, str2, and carry.
3 days ago
Line 26, your program would already have thrown a NPE before you got here to check for null.
Lines 33 & 38, you want to compare using >= 0.
Line 30 -ditto-
Lines 46 & 47 should be outside the loop.
Line 49 should be outside the loop.
3 days ago