R
Rick Osborn
I couldn't find anything in any of my text's.
Just the name.
Just the name.
someThing = docRoot == null ? this.root : doc root;I couldn't find anything in any of my text's.
Just the name.
Doug Schwartz said:The ternary operator is shorthand for:
if(docRoot == null)
{
this.root;
}
else
{
doc root;
}
Your code doesn't look legit, but that's not your question.
Joona said:This gives the impression that this code:
(docRoot == null ? this.root : docRoot).someMethod();
is shorthand for:
if (docRoot == null) {
this.root;
}
else {
docRoot;
}.someMethod();
which is very much invalid Java syntax. It is really shorthand for:
if (docRoot == null) {
this.root.someMethod();
}
else {
docRoot.someMethod();
}
Rick Osborn said:I couldn't find anything in any of my text's.
Just the name.
Rick said:It's amazing. I only have exam guides left and none had it.
Only examples using it.
They also have "+=" but none explain in detail. I assume it's
shorthand for concatenation/re-assignment. But none says for sure.
Am I right?
find things in your text book.
Rick said:It's amazing. I only have exam guides left and none had it.
Only examples using it.
They also have "+=" but none explain in detail. I assume it's
shorthand for concatenation/re-assignment. But none says for sure.
Am I right?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.