I'm a C\C++
programmer just starting on Java
.
I came across this working Java snippet syntax that I understand what it does but I can't understand the logic of the syntax.
object x = new object
.SetContent(aaa)
.SetIcon(bbb)
.SetText(ccc);
I get that the equivalent C++
code is:
object* x = new object;
x->SetContent(aaa);
x->SetIcon(bbb);
x->SetText(ccc);
Can anyone explain to me the logic in the Java syntax?
Is this something like the Visual Basic's With
Statement?
P.S. Don't think it matters but the Java snippet is from an Android program.
This is
method chaining in java
, where each method returns the current instance so that you can invoke the next method on current returned object from that method.