[appengine-java] Quiz

2011-09-29 Thread gk
What is the output of the following method?

public boolean whatDoesItDo()
{
try
{
if(true)
{
throw new IllegalStateException();
}
return true;
}
finally
{
if(true)
{
return false;
}
}
}

Have a nice time figuring it out ;-)

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Quiz

2011-09-29 Thread Stephen Johnson
That's easy. You are not supposed to return a value in the finally block
since it overwrites any previous return values and also any exceptions that
are thrown. Return statements in a finally block are a big NO-NO.

Stephen
CortexConnect.com

On Thu, Sep 29, 2011 at 3:36 PM, gk goran.kar...@googlemail.com wrote:

 What is the output of the following method?

 public boolean whatDoesItDo()
 {
try
{
if(true)
{
throw new IllegalStateException();
}
return true;
}
finally
{
if(true)
{
return false;
}
}
 }

 Have a nice time figuring it out ;-)

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-java@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Quiz

2011-09-29 Thread Stephen Johnson
So the answer is false. Forgot to actually state that.

On Thu, Sep 29, 2011 at 3:44 PM, Stephen Johnson onepagewo...@gmail.comwrote:

 That's easy. You are not supposed to return a value in the finally block
 since it overwrites any previous return values and also any exceptions that
 are thrown. Return statements in a finally block are a big NO-NO.

 Stephen
 CortexConnect.com


 On Thu, Sep 29, 2011 at 3:36 PM, gk goran.kar...@googlemail.com wrote:

 What is the output of the following method?

 public boolean whatDoesItDo()
 {
try
{
if(true)
{
throw new IllegalStateException();
}
return true;
}
finally
{
if(true)
{
return false;
}
}
 }

 Have a nice time figuring it out ;-)

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-java@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Quiz

2011-09-29 Thread Prabakaran R
Hi
return false ,finally must be excute.

On Fri, Sep 30, 2011 at 4:06 AM, gk goran.kar...@googlemail.com wrote:

 What is the output of the following method?

 public boolean whatDoesItDo()
 {
try
{
if(true)
{
throw new IllegalStateException();
}
return true;
}
finally
{
if(true)
{
return false;
}
}
 }

 Have a nice time figuring it out ;-)

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-java@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
Thanks  Regards
R.Prabakaran

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.