exception in thread "main" java.nosuchmethoderror:main
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5407250/causes-of-java-lang-nosuchmethoderror-main-exception-in-thread-main">Causes of &#39;java.lang.NoSuchMethodError: main Exception in thread &ldquo;main&rdquo;&#39;</a>  </p>
</blockquote>



<p>i am new in java.i want to write a program to swap 2 nos.<br>
i have written 2 programs on it.one is running and other is not.<br>
i cant understand the fault of the not running program.pls help me to understand my fault.<br>
here i giving you both the programs along with the output.</p>

<p>the running program:</p>

<pre><code>public class SwapElementsExample {


public static void main(String[] args) {

int num1 = 10;
int num2 = 20;

System.out.println("Before Swapping");
System.out.println("Value of num1 is :" + num1);
System.out.println("Value of num2 is :" +num2);
swap(num1, num2); 
}

private static void swap(int num1, int num2) {  
int temp = num1;  
num1 = num2;  
num2 = temp;  

System.out.println("After Swapping");
System.out.println("Value of num1 is :" + num1);
System.out.println("Value of num2 is :" +num2);
}
}
</code></pre>

<p>the output is:</p>

<p>before swapping<br>
value of num1 is : 10<br>
value of num2 is : 20<br>
after swapping<br>
value of num1 is : 20<br>
value of num2 is : 10  </p>

<p>in the above mentioned program i have not any problem.<br>
but in the next program what is the fault i cannot find.<br>
pls help me to find the error.</p>

<pre><code>class Swap  
{  
public static void main(int a, int b)  
{  
int c=0;  
c=b;  
b=a;  
a=c;  
c=0;  
System.out.println(a);  
System.out.println(b);  
}  
}  
</code></pre>

<p>in the execution there is no error msg.<br>
but in runtime there is a error msg and that is:<br>
exception in thread "main" java.nosuchmethoderror:main  </p>

<p>pls let me know the problem of this program.</p>

<hr>
