On 6/11/2013 3:50 PM, Ravishankar Rajagopalan wrote:
Hi,
I am trying out the homework for Java Arrays. I am getting an error
with the split statement. I have given the code that I am using below.
Could you please let me know what is wrong with my approach?
Can you post the error log?
import javax.swing.JOptionPane;
public class LongestName {
public static void main(String[] args) {
//int[] num = new int[10];
String [] personfull = new String[3];
String [] firstname = new String[3];
int counter;
int max = 0;
int totalnumber = 3;
for (counter = 0;counter < totalnumber;counter++){
personfull[counter] = JOptionPane.showInputDialog("Enter the
name");
firstname[counter] = personfull[counter].split(" ");
}
for(counter = 0;counter < totalnumber; counter++){
System.out.println(personfull[counter]);
System.out.println(firstname[counter]);
}
}
}
Thank you.
Regards,
Ravishankar Rajagopalan
--
You received this message because you are subscribed to the Google
Groups "JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
-------------------------------------------------------------------
Sang Shin, [email protected]
Founder and Chief Instructor of JPassion.com (JavaPassion.com)
http://www.linkedin.com/in/javapassion (Linkedin)
http://twitter.com/javapassion (Tweeter)
Life is worth living... with Passion!
Practically Free 3 to 5 days Live, Hands-on, Online Codecamps on
Java, HTML5, Ruby/Rails, Grails, JavaScript/jQuery, Spring, Android
http://jpassion.com/codecamps
----------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.