call method compare

  1. package firstjava;
  2.  
  3. public class Max {
  4.  
  5.     public  static int max(int iFint iS ){
  6.         if ( iF > iS)
  7.             return iF;
  8.         else if ( iF < iS )
  9.             return iS;
  10.         else
  11.             return 0;
  12.        
  13.     }
  14.     public static void main(String[] args) {
  15.         // TODO Auto-generated method stub
  16.         int i=5;
  17.         int j=9;
  18.         int k;
  19.         k = max(i, j);
  20.         if ( k==0 )
  21.             System.out.println("Equal");
  22.         else
  23.             System.out.println("The bigger one is " + k );
  24.     }
  25.  
  26. }

留言

這個網誌中的熱門文章

Codeforces --- string task

Uva 674 ---- coin change

codeforces 271A --- beautiful year