PhiSe:
ただ、この声明に出くわしたと、この関数呼び出しが最初で、キャストのように見えたものを持っていた理由は不思議でしたか?
SomeClass bo = new SomeClass(); // blabla something like that to initialize the object variable
(bo).setValue(bo.getValue().negate());
私はまだこの構文を見ていないとして - それはシンプルに比べて何をするのか
bo.setValue(bo.getValue().negate());
?
アンドリューTobilko:
(bo).setValue(bo.getValue().negate())
そして、bo.setValue(bo.getValue().negate())
同じ文であり、括弧はここreduntantです。
彼らは、私たちのような表現を書く時にかかわらず必要とされています
Object o;
(o = new Object()).toString(); // class java.lang.Object
我々はそれらを省略した場合は、
Object o;
o = new Object().toString(); // class java.lang.String