This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!

Sridher Reddy

+ Follow
since Mar 27, 2007
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 Sridher Reddy

Another point observed in the KnB book is that for almost all the examples the authors have used the following code...

Pattern p = Pattern.compile("aba");
Matcher m = p.matcher("ababababababa");
boolean b = false;

while (b = m.find)
{ System.out.print("Answers"); }

Now can anyone please help me out with the value of using the "while (b = m.find)" option?
I find it works the same with out the boolean too "while (m.find)"
Is it actually necessary or am i missing something here?

Hi All,
Was going through the section on Regex in Knb and i feel i would need more than what is given in there to be comfortable work with Regex. (especially on the greedy quantifiers topic)
The book mentions that various sun tutorials would have more information.
Anyone having the links readily, kindly post them.

Would also appreciate in case ranchers would give their opinions on how much of depth is really required in this topic.

Yayy. that works.
Thank you so much :-)
11 years ago
Hi all,
I have a very silly sounding question, but i'm not able to get my hands on the answer. maybe somebody there can help.

In my root folder, i have 2 packages call them pack1 and pack2.
the code for a java file in each package is mentoined below.

//in first package
package pack2;
import pack1.Java_ranch2;
public class TechnoSample {}

//in other package
package pack1;
import pack2.TechnoSample;
public class Java_ranch2
static public void main(String... a) {
TechnoSample t = new TechnoSample();

for some reason, on trying to compile the second class (Java_ranch2) the compiler screams

package pack2 does not exist
import pack2.TechnoSample;

anything i'm missing here? :-(
11 years ago
to add to Manfred's explaination...
what the line also means is that, the "enhanced for loop" and the "basic for loop", both will continue to work the way mentioned above unless they encounter any of the
System.exit(0); or break; or continue; statements.
Typecasting X to Z without X extending Z would give you a Compile time Error (inconvertible types).
But in case X extends Z, then the instance z is allowed to use all methods of X. (like a normal extended class)

Class Z {}
Class X extends Z{ Z z = (Z) new X(); }

Does this answer your question?
Thanks John. The SCJPFAQ helps

and Hey there, Marc.. i've changed my name to my original
thought i could get away keeping my login and user name the same..
wasn't aware of the policy though. thanks.
Does anyone have links/ref to study material for SCJP5.0.
i was only able to find Kathy and Bert's SCJP book for this.

Request anyone having information regarding this to kindly share it.
Replies appreciated.