Hello friends,

I have solved the homework question in this way

import javax.swing.JOptionPane;

public class OwnJavaArray {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int counter,max=0;
        String[][] nameArrayForPerson= new String[3][2];
        int[] lengthOfFirstNameOfPerson=new int[3];
        
        for(counter=0;counter<=2;counter++)
        {
           nameArrayForPerson[counter]=(JOptionPane.showInputDialog("Enter your 
full name giving space between them").split(" "));
           
lengthOfFirstNameOfPerson[counter]=nameArrayForPerson[counter][0].length();
        }    
        
        
        
         for(counter=0;counter<3;counter++)
        {
            if(lengthOfFirstNameOfPerson[counter] > max)
                max = counter;
         }
        
        JOptionPane.showMessageDialog(null,nameArrayForPerson[max] + "  has 
longest first name");
        
    }

}






It is comparing in a correct way but while printing the name of the person 
giving som garbage value.
Please help me .




      Connect with friends all over the world. Get Yahoo! India Messenger at 
http://in.messenger.yahoo.com/?wm=n/
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to