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 += JOptionPane.showInputDialog("Enter fullnameuntil" + totalnames
+ "are entered")+",";
 }
 System.out.println(name.split(",",2)[0]);
 }
    }
Due to the help of dear Ashok, the solution may like this?


Hugs,
Eric Cai

On Thu, Jul 30, 2009 at 6:18 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