Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Give me clear Idea about return statement

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 10-27-2010, 09:04 AM PM User | #1 Anep New to the CF scene   Join Date: Oct 2010 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts Give me clear Idea about return statement Dear All, I am confusing little bit on return statements. Give me clarity about the return statements. Explain with Example.
 10-30-2010, 08:37 AM PM User | #2 sujithpr New Coder   Join Date: Aug 2009 Location: Cochin,India Posts: 39 Thanks: 2 Thanked 1 Time in 1 Post The return statement is used to return the value within the body of method. The method declared void does not return any value. The method that is not declared void must contain a return statement with the corresponding return value.: class ReturnValue { public static void main (String[] args) { System.out.println("The Biggest Number is: "+GetBiggestNumber(10, 15, 20)); } public static int GetBiggestNumber (int num1, int num2, int num3) { int biggest = 0; if ((num1 > num2) && (num1 > num3)) biggest = num1; else if ((num2 > num3) && (num2 > num1)) biggest = num2; else biggest = num3; return biggest; } } Output will be displayed as: The Biggest Number is :20
 11-10-2010, 09:44 PM PM User | #3 Dmor574 New to the CF scene   Join Date: Nov 2010 Posts: 2 Thanks: 0 Thanked 0 Times in 0 Posts In simple terms, if you call a method that returns a value(which looks like this) Code: ```public int number() { int x = 5; return x; }``` and this method above returns an 'int' type. A method that returns a value must use the keyword: "return". and whatever follows the return statement must correspond with what you wrote in the method declaration. This example says 'int' in the declaration, but you can change it to any primitive, or any object, including boolean, String, etc. If you would call that method, whatever is returned (in this case x = 5, which is 5) is replaced by the call to the method. Code: `int y = number();` is like saying Code: `int y = 5;` Last edited by Dmor574; 11-10-2010 at 09:48 PM..

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 12:45 AM.