import javax.swing.JOptionPane;

public class TestSplit {
        

           /**
            * @param args the command line arguments
            */
           public static void main(String[] args) {
        
              int i;
              int totalnames=3;
              String[] name ={"","",""};
        
              for(i=0;i<totalnames;i++){
                  name[i] = JOptionPane.showInputDialog("Enter fullname
until"+totalnames+"are entered" );
              }

              for(String namestr : name){
                System.out.println("Names : "+namestr);
              }
           }

        }

Now try using split . But you will have to decide the split criteria .
Is it going to be a comma (or) is it going to be a white space
that determines the First Name. and also the position :) .

More on split() can be found @  :
http://www.java-examples.com/java-string-split-example

Thanks,
Ashok A V

On Thu, Jul 30, 2009 at 3:48 PM, devika shukla<[email protected]> wrote:
>
> In the program given below
> I want to get the First names of persons  but I am unable to get
> please help me to proceede
> Also please tell me the concept of "split() instance (non-static) method"
> How does  it works?
>
>
> import javax.swing.JOptionPane;/*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
>
> /**
>  *
>  * @author rest
>  */
> public class myownjavaarrayproject {
>
>    /**
>     * @param args the command line arguments
>     */
>    public static void main(String[] args) {
>       String name[]={};
>       int i;
>   int totalnames=3;
>       for(i=0;i<totalnames;i++){
>
>           JOptionPane.showInputDialog(" Enter fullname
> until"+totalnames+" are entered" );
>       }
>
>        // TODO code application logic here
>    }
>
> }
>
>
>
> Thanks & Regards
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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