<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Java ?: operator</title>
	<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/</link>
	<description>Utterly random, incoherent and disjointed rants and ramblings...</description>
	<pubDate>Sat, 22 Nov 2008 08:17:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>

	<item>
		<title>by: test</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-10030</link>
		<pubDate>Tue, 02 Sep 2008 10:37:08 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-10030</guid>
					<description>another advantage that it will not excute statement1:statement2 only the correct one</description>
		<content:encoded><![CDATA[<p>another advantage that it will not excute statement1:statement2 only the correct one
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7267</link>
		<pubDate>Wed, 05 Dec 2007 21:45:06 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7267</guid>
					<description>Ya thanks, it make sense.</description>
		<content:encoded><![CDATA[<p>Ya thanks, it make sense.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Luke Maciak</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7266</link>
		<pubDate>Wed, 05 Dec 2007 21:29:00 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7266</guid>
					<description>Well, that is the one way you are not supposed to use the question mark statement. This statement is supposed to evaluate the boolean, and based on it's value return the result of the statement to the left or the right of the colon.

In other words, the two statements are required to return a value. Since println() is void, I believe this syntax will throw error. So you are right, in your example, the if statement is definitely the correct approach.

To put it more simply, the question mark statement must evaluate to (or return) a value of some sort. It is not supposed to be used to perform an action.

I hope that makes sense. :)</description>
		<content:encoded><![CDATA[<p>Well, that is the one way you are not supposed to use the question mark statement. This statement is supposed to evaluate the boolean, and based on it&#8217;s value return the result of the statement to the left or the right of the colon.</p>
<p>In other words, the two statements are required to return a value. Since println() is void, I believe this syntax will throw error. So you are right, in your example, the if statement is definitely the correct approach.</p>
<p>To put it more simply, the question mark statement must evaluate to (or return) a value of some sort. It is not supposed to be used to perform an action.</p>
<p>I hope that makes sense. <img src="http://www.terminally-incoherent.com/blog/wp-includes/images/smilies/icon_smile.gif" alt=")" class="wp-smiley" />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7265</link>
		<pubDate>Wed, 05 Dec 2007 21:17:21 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7265</guid>
					<description>But with the question mark operator, it did not work.</description>
		<content:encoded><![CDATA[<p>But with the question mark operator, it did not work.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7264</link>
		<pubDate>Wed, 05 Dec 2007 21:15:14 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7264</guid>
					<description>&lt;blockquote&gt;Well I used something like

(boolean)? System.out.println("Some text"):System.out.println("Some other text");

Putting it in an if statement works no problem.&lt;/blockquote&gt;&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<blockquote><p>Well I used something like</p>
<p>(boolean)? System.out.println(&#8221;Some text&#8221;):System.out.println(&#8221;Some other text&#8221;);</p>
<p>Putting it in an if statement works no problem.</p>
</blockquote>
</blockquote>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7263</link>
		<pubDate>Wed, 05 Dec 2007 21:09:09 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7263</guid>
					<description>thx, I'll repost.</description>
		<content:encoded><![CDATA[<p>thx, I&#8217;ll repost.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Luke Maciak</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7260</link>
		<pubDate>Wed, 05 Dec 2007 20:21:48 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7260</guid>
					<description>Patrick - I think your comment got eaten. Remember, you can't use the &#60; and &#62; unless you put them in the &#60;pre&#62; tag. Click the code button above the textbox. Observe:

&lt;pre lang="java"&gt;inside here I can use &lt;&gt; as normal&lt;/pre&gt;

Alternatively you can use the &#38;lt; and &#38;gt; HTML entities like I did above.

Also, preview button does wonders for you. ;)</description>
		<content:encoded><![CDATA[<p>Patrick - I think your comment got eaten. Remember, you can&#8217;t use the &lt; and &gt; unless you put them in the &lt;pre&gt; tag. Click the code button above the textbox. Observe:</p>

<div class="wp_syntax"><div class="code"><pre class="java">inside here I can use &lt;&gt; as normal</pre></div></div>

<p>Alternatively you can use the &amp;lt; and &amp;gt; HTML entities like I did above.</p>
<p>Also, preview button does wonders for you. <img src="http://www.terminally-incoherent.com/blog/wp-includes/images/smilies/icon_wink.gif" alt=")" class="wp-smiley" />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7259</link>
		<pubDate>Wed, 05 Dec 2007 19:52:27 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7259</guid>
					<description>public Playlist(Playlist playList){
    if (playList != null){
      for(int i = 0; i</description>
		<content:encoded><![CDATA[<p>public Playlist(Playlist playList){<br />
    if (playList != null){<br />
      for(int i = 0; i
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ellioman</title>
		<link>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7028</link>
		<pubDate>Sun, 18 Nov 2007 16:01:08 +0000</pubDate>
		<guid>http://www.terminally-incoherent.com/blog/2006/04/21/java-operator/#comment-7028</guid>
					<description>Thanks for this!
I needed a good explanation, and you gave me one ;)

Cheers from Iceland.</description>
		<content:encoded><![CDATA[<p>Thanks for this!<br />
I needed a good explanation, and you gave me one <img src="http://www.terminally-incoherent.com/blog/wp-includes/images/smilies/icon_wink.gif" alt=")" class="wp-smiley" /> </p>
<p>Cheers from Iceland.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.545 seconds -->
