Anshul Singhal wrote:shouldn't there be some variable to handle the return type??
No. Methods can always be chained, eg:
String trimmedSubstr = someString.subString(10, 99).trim();
as long as the next method in sequence is valid for the value returned by previous one.
However, what you're seeing is a style used by a lot of Builder implementations, called a
Fluent Interface.
It hasn't really caught on in a major way generally, because good FIs are tough to design (and easy to get
wrong 
); but it does dovetail quite nicely with the Builder
pattern.
HIH
Winston