Hello All, It would be necessary to instantiate an object JOptionPane to use it? I think yes ...
Erick Pessoa 2009/7/21 sudhir Ganesh Paluru <[email protected]> > Hello All, > > I am trying out 1036 homework and have the following issue > > code : > _____ > > import javax.swing.JOptionPane; > public class ArrayHomeProject { > > /** > * @param args the command line arguments > */ > public static void main(String[] args) { > // TODO code application logic here > String name[] = new String[3]; > // String firstName[] = new String[6]; > String max = ""; > for (int i=0;i<3;i++) > { > name[i] = JOptionPane.showInputDialog("Enter threee names"+i); > } > for (int j=0;j<3;j++) > { > String firstName[] = name[j].split(" "); > if((j==0)||(max.length()>firstName[j].length())) > { > max = firstName[j]; > } > } > System.out.println("The longest first name is"+max); > } > > } > > Error Message when i run it: > ___________________________ > > run: > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 > at ArrayHomeProject.main(ArrayHomeProject.java:28) > Java Result: 1 > > Any pointers would be appreciated. > > Thanks, > Sudhir > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
