Java Methods

Java Simple Method Example:



/** 

 * 

 */ 

package com.first; 

 /** 

 * 
@author chintha Ramu 

 * */ 
public class JavaMethods { 

 /** 
 * @param args 
 */ 

 public static void main(String[] args) { 

 // TODO Auto-generated method stub 

 // Calculate two numbers 

 calculate(5,5); 

 } 
 private static void calculate(int i, int j) { 

 // TODO Auto-generated method stub 

 System.out.println("Result of the two numbers-->"+i*j);                                                      
}
 }


Output:


0 comments:

Post a Comment