<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Java%2FC2%2FMethods%2FEnglish</id>
		<title>Java/C2/Methods/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Java%2FC2%2FMethods%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Java/C2/Methods/English&amp;action=history"/>
		<updated>2026-04-09T01:32:02Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Java/C2/Methods/English&amp;diff=104&amp;oldid=prev</id>
		<title>Chandrika: Created page with ''''Title of script''': methods in java.  '''Author: Prathamesh Salunke'''  '''Keywords: video tutorial, methods.'''    {| style=&quot;border-spacing:0;&quot; ! &lt;center&gt;Visual Cue&lt;/center&gt; …'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Java/C2/Methods/English&amp;diff=104&amp;oldid=prev"/>
				<updated>2012-11-27T10:16:03Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;#039;&amp;#039;&amp;#039;Title of script&amp;#039;&amp;#039;&amp;#039;: methods in java.  &amp;#039;&amp;#039;&amp;#039;Author: Prathamesh Salunke&amp;#039;&amp;#039;&amp;#039;  &amp;#039;&amp;#039;&amp;#039;Keywords: video tutorial, methods.&amp;#039;&amp;#039;&amp;#039;    {| style=&amp;quot;border-spacing:0;&amp;quot; ! &amp;lt;center&amp;gt;Visual Cue&amp;lt;/center&amp;gt; …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Title of script''': methods in java.&lt;br /&gt;
&lt;br /&gt;
'''Author: Prathamesh Salunke'''&lt;br /&gt;
&lt;br /&gt;
'''Keywords: video tutorial, methods.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;br /&gt;
! &amp;lt;center&amp;gt;Visual Cue&amp;lt;/center&amp;gt;&lt;br /&gt;
! &amp;lt;center&amp;gt;Narration&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 1 &lt;br /&gt;
&lt;br /&gt;
Opening slide&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Welcome to the Spoken Tutorial on '''methods java'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 2&lt;br /&gt;
&lt;br /&gt;
Learning Objectives&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| In this tutorial we will learn &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;* To create a method. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;* To call a method.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 3&lt;br /&gt;
&lt;br /&gt;
System Requirements&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Here we are using &lt;br /&gt;
&lt;br /&gt;
* Ubuntu version 11.10 &lt;br /&gt;
* Java Development Environment jdk 1.6 and&lt;br /&gt;
* Eclipse 3.7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 4&lt;br /&gt;
&lt;br /&gt;
Prerequisites&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| To follow this tutorial you must know how to write, compile and run a simple java program in eclipse.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not, for relevant tutorials please visit our website which is as shown,&lt;br /&gt;
&lt;br /&gt;
(http://www.spoken-tutorial.org) &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 5&lt;br /&gt;
&lt;br /&gt;
Method Definition&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| A java method is a collection of statements that performs a specified operation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to eclipse&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Point to the Project '''Methods'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us now write a method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So, in the '''eclipse,''' I have already created a project Methods.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to the '''MethodDemo''' class&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| In the project, I have created a java class MethodDemo&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''void displayMessage()'''''&lt;br /&gt;
&lt;br /&gt;
'''''{}'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| In the class outside main method we will write a method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So type '''''void''''' name of the method&lt;br /&gt;
&lt;br /&gt;
Let us name it as '''''displayMessage''''' ''parentheses'' &lt;br /&gt;
&lt;br /&gt;
And ''curly'' ''brackets.''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight '''void'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| A method can return a value.&lt;br /&gt;
&lt;br /&gt;
But if you don’t want the method to return a value then keyword void is used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| == System.out.println(“Hello Method”); ==&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now inside the curly brackets, let us print a message.&lt;br /&gt;
&lt;br /&gt;
So type '''''System '''dot''' out '''dot''' println ''Hello''' '''Method'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type :&lt;br /&gt;
&lt;br /&gt;
'''''Methods md&amp;lt;nowiki&amp;gt;=new Methods();&amp;lt;/nowiki&amp;gt;'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So we have written a method.&lt;br /&gt;
&lt;br /&gt;
Let us now call this method.&lt;br /&gt;
&lt;br /&gt;
So inside '''Main''' method, let us create an object of the class.&lt;br /&gt;
&lt;br /&gt;
So type class name i.e '''MethodDemo''' name of the object.&lt;br /&gt;
&lt;br /&gt;
Let us name it as '''md&amp;lt;nowiki&amp;gt;=new&amp;lt;/nowiki&amp;gt;''' '''MethodDemo''' ''parentheses'', ''semicolon.'' &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight new&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So we have created an object of the class '''MethodDemo''' using the '''New''' operator.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So now let us call the method '''displayMessage.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''md.displayMessage();'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So type '''''md''''' ''dot'' '''''displayMessage''''' ''parentheses'', ''semicolon.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight '''Dot''' operator.&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| The '''Dot''' operator is used to call the method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Click on '''Run''' icon&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us '''Run''' the application by clicking on Run icon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Output: &lt;br /&gt;
&lt;br /&gt;
'''Hello Method'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| We see the output '''Hello''' '''Method '''on''' '''the''' '''console&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Replace '''''void''''' by '''''int'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us now return an integer value.&lt;br /&gt;
&lt;br /&gt;
So in place of '''''void''''' type '''''int.'''''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type '''''public'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Also make the method public, that is accessible everywhere.&lt;br /&gt;
&lt;br /&gt;
By default it is private, that is accessible only within the class where it is written.&lt;br /&gt;
&lt;br /&gt;
So type '''''public.'''''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''return 7;'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now inside the method type '''''return''''' ''seven'', ''semicolon''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight '''return'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Remember '''return''' is written at the end of all statements in the method.&lt;br /&gt;
&lt;br /&gt;
This is because after '''return''' statement no other statements are executed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''System.out.println();'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now inside the '''Main''' method at the end type print statement.&lt;br /&gt;
&lt;br /&gt;
So '''System''' ''dot'' '''out''' ''dot'' '''println();'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''''System.out.println(displayMethod());'''''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Inside ''parenthesis'' we will call the method.&lt;br /&gt;
&lt;br /&gt;
So put '''''md''''' ''dot'' method inside the ''parentheses'' and remove the ''semi''-''colon''.&lt;br /&gt;
&lt;br /&gt;
This will print the return value of the method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Click on '''Run''' icon&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| '''Run''' the application.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Output: &lt;br /&gt;
&lt;br /&gt;
'''Hello Method'''&lt;br /&gt;
&lt;br /&gt;
'''7'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| We see in the output, the value '''7''' is printed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''public void square(int a)'''''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now we will write another method and call it in '''displayMessage.'''&lt;br /&gt;
&lt;br /&gt;
So type '''''public void '''''method name '''''square '''''within ''parentheses'' '''''int a'''''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight '''''int''''' '''''a'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Here we are giving int a as a parameter to our method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''{'''''&lt;br /&gt;
&lt;br /&gt;
'''''System.out.println(a*a);'''''&lt;br /&gt;
&lt;br /&gt;
'''''}'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now within ''curly'' brackets, '''''System '''dot '''out '''dot''' println''''' within parentheses '''''a''''' ''into'' '''''a'''''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Highlight '''''square'''''() method&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So we have written a '''square''' method.&lt;br /&gt;
&lt;br /&gt;
It will display a square of the integer given as a parameter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| In the '''displayMessage'''&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
'''''square(5); '''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us call this method in '''displayMessage'''.&lt;br /&gt;
&lt;br /&gt;
So type '''''square''''' within ''parentheses'' an integer '''''5''''', ''semicolon.''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Click on '''Run''' icon&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| '''Run''' the application.&lt;br /&gt;
&lt;br /&gt;
We see that the output displays the square of '''5''' that is '''25.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to '''Main''' method&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us understand the flow of the application.&lt;br /&gt;
&lt;br /&gt;
The starting point is the '''Main''' method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to '''displayMessage()'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| In the '''Main '''method''', '''we have first called the '''displayMessage'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to the statements in '''displayMessage'''()&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So the control goes to the '''displayMessage.'''&lt;br /&gt;
&lt;br /&gt;
And all the statements in the '''displayMessage''' are executed. &lt;br /&gt;
&lt;br /&gt;
The first one is the '''print''' statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to the '''square''' method&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Then it comes across the '''square''' method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to the statements in the '''square''' method&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So the control jumps to the '''square''' method. &lt;br /&gt;
&lt;br /&gt;
The square method takes an integer 5 and returns the square of the integer i.e. 25.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to''' displayMessage()'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Then the control goes back to the '''displayMessage'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to '''7'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| And it returns the value '''7'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to '''Main''' method.&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| The control jumps back to '''Main''' method.&lt;br /&gt;
&lt;br /&gt;
Since there are no statements to execute, the application terminates&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type:&lt;br /&gt;
&lt;br /&gt;
'''''static'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Let us now make '''displayMessage''' as '''static'''.&lt;br /&gt;
&lt;br /&gt;
So after '''''public''''' type '''''static''.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to the '''error'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| We see that we cannot call a non static method in the '''static''' one. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| //square(5);&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So we will comment this call.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Point to '''static''' of '''Main'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Since '''Main''' is a static method, we can call the static method displayMessage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''''//MethodDemo md&amp;lt;nowiki&amp;gt;=new Method&amp;lt;/nowiki&amp;gt;Demo();'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now for static method we do not need to create an object.&lt;br /&gt;
&lt;br /&gt;
So comment the object creation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''Delete''' '''md'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Also '''Delete''' '''md.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Output:&lt;br /&gt;
&lt;br /&gt;
'''Hello''' '''Method'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| '''Run''' the application.&lt;br /&gt;
&lt;br /&gt;
We see the output Hello Method and 7.&lt;br /&gt;
&lt;br /&gt;
We do not see 25 because we have commented the call to square method&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to the class '''Demo'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| We can also call method from other class.&lt;br /&gt;
&lt;br /&gt;
So for that I have created a class '''Demo.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''''Public void show()'''''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''System.out.println(“I am from other class”);''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Inside the class create a method.&lt;br /&gt;
&lt;br /&gt;
So type '''''public void show''' parentheses''&lt;br /&gt;
&lt;br /&gt;
Within ''curly brackets'', type''''' System '''dot''' out '''dot''' println'''''&lt;br /&gt;
&lt;br /&gt;
'''''I am from other class.'''''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''Press'' Ctrl+S'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| '''Save''' the file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to '''MethodDemo'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Then go back to the '''MethodDemo''' class&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Type: &lt;br /&gt;
&lt;br /&gt;
'''''Demo d=new Demo;'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Now we will call this '''show''' method in '''MethodDemo''' class.&lt;br /&gt;
&lt;br /&gt;
For that we need to create the object of the class '''Demo.'''&lt;br /&gt;
&lt;br /&gt;
This is because the method '''show''' belongs to the class '''Demo.'''&lt;br /&gt;
&lt;br /&gt;
So type '''Demo d=new Demo''' ''parentheses,'' ''semicolon''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| '''''d.show();'''''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Then call method '''show''' parentheses.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Output:&lt;br /&gt;
&lt;br /&gt;
'''I am from other class'''&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Lets '''Run''' the application.&lt;br /&gt;
&lt;br /&gt;
We see on the console I am from other class.&lt;br /&gt;
&lt;br /&gt;
This is how methods are used in java.&lt;br /&gt;
&lt;br /&gt;
The method name and the parameters forms the signature of the method.&lt;br /&gt;
&lt;br /&gt;
While the statements inside the curly brackets forms the body of the method. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 7&lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| So in this tutorial, we have learnt &lt;br /&gt;
&lt;br /&gt;
* To create a method&lt;br /&gt;
* To call a method&lt;br /&gt;
* Different signatures of methods&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 8&lt;br /&gt;
&lt;br /&gt;
Assignment&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| For self assessment, create a method which prints the cube of an integer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 9&lt;br /&gt;
&lt;br /&gt;
About Slide&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| To know more about the Spoken Tutorial Project&lt;br /&gt;
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-][http://spoken-tutorial.org/What_is_a_Spoken_Tutorial tutorial.org/What_is_a_Spoken_Tutorial] &lt;br /&gt;
* It summarizes the Spoken Tutorial project &lt;br /&gt;
&lt;br /&gt;
* If you do not have good bandwidth, you can download and watch it &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 10&lt;br /&gt;
&lt;br /&gt;
About Slide &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| The Spoken Tutorial Project Team &lt;br /&gt;
&lt;br /&gt;
* Conducts workshops using spoken tutorials &lt;br /&gt;
&lt;br /&gt;
* Gives certificates for those who pass an online test &lt;br /&gt;
&lt;br /&gt;
* For more details, please write to contact@spoken-tutorial.org &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 11&lt;br /&gt;
&lt;br /&gt;
Acknowledgment&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| Spoken Tutorial Project is a part of the Talk to a Teacher project &lt;br /&gt;
&lt;br /&gt;
* It is supported by the National Mission on Education through ICT, MHRD, Government of India &lt;br /&gt;
&lt;br /&gt;
* More information on this Mission is available at &lt;br /&gt;
&lt;br /&gt;
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 12&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.035cm solid #000000;border-left:0.035cm solid #000000;border-right:0.035cm solid #000000;padding:0.097cm;&amp;quot;| We have come to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
Thanks for joining.&lt;br /&gt;
&lt;br /&gt;
This is Prathamesh Salunke signing off. &lt;br /&gt;
&lt;br /&gt;
Jai Hind. &lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Chandrika</name></author>	</entry>

	</feed>