Develop a Java program to display the name of the players, who played more test matches. Given the names and numbers of test matches played of three players.

class Players
{
 public static void main(String[] args) 
 {
  String name[] = {"Rahul Dravid", "Sachin Tendulkar", "Sourav Ganguly"};
  int matches[] = {164, 200, 113};
  int index=-1, large=0;
  for(int i=0;i<3;i++)
  {
   if(large < matches[i])
   {
    large = matches[i];
    index = i;
   }
  }  
  System.out.println("Highest Test Match has been played by "+ name[index] +" with " +matches[index] + " matches");
 }
}
/*   OUTPUT!!!!
Highest Test Match has been played by Sachin Tendulkar with 200 matches
*/

Copyright © LetML. Blogger Templates Designed by OddThemes