Rob Prime wrote:You're welcome
One note though: this kind of method chaining makes it a bit harder to debug NullPointerExceptions. If you would get one on that line there could be a few causes:
- object is null
- object.method1() returns null
- object.method1().method2() returns null
- object.method1().method2().method3() returns null
So only use this kind of chaining if you know the method results will not be null. Thread.currentThread() will not return null so your example is safe.
abalfazl hossein wrote:I run both by netbeans:
This the result of running of sockettest:
run:
Couldn't get I/O for the connection to: hostname
Rob Prime wrote:Maybe you can answer this yourself with a little example and follow-up question.
Now, which object is used for calling method3()?
Campbell Ritchie wrote:
I had already said "easily extract the password", and Rob and Jesper have given fuller explanations.Jatin Dhingra wrote: . . ..can anyone gain access to data inside serialized object IF he does not have class of serialized object ? . . .