I don't understand why you want to delete second letters of each string but
snippet that you can use is as following :

public static String generateNewName(String[] names) {
        String name = "";

        for (int i = 0; i < names.length; i++) {
            name += names[i].charAt(1);
        }

        return name;
    }

On Thu, Aug 27, 2009 at 2:00 PM, moses <[email protected]> wrote:

>
> please help me with my built in class homework with this one
>
> import javax.swing.JOptionPane;
> public class mybuiltinclasses {
>
>    public static void main(String[] args) {
>        //Receive the first names of your family members (between 3 to
> 6 members of your family) as command line arguments and create an
> array of String.
>        //Write a static method called generateNewName() as following:
>        // * It receives the array of String as a parameter.
>        // * It creates a new first name by taking the 2nd character
> of each String from the array
>        // Display the names that were enetered and newly generated
> name
>        String[] name=new String[3];
>        //char x = str1.charAt(0);
>        for(int i=0;i<3;i++){
>        name[i]=args[i];
>        }
>
>        generateNewName(x1);
>
>        for(int i=0;i<2;i++){
>        System.out.println(name[i]);
>        }
>        String newname = x1.concat(x2.concat(x3));
>        System.out.println("New Name is" + newname);
>    }
>    public static void generateNewName(String[] name, String x1,String
> x2,String x3)
>    {
>        for(int j=0;j<3;j++){
>        System.out.println(name[j]);
>
>        x1=name[0].substring(1,1);
>        x2=name[1].substring(1,1);
>        x3=name[2].substring(1,1);
>
>        }
>
>    }
>
> }
>
>
> i can't figure out how to delete each 2nd letter in the string names
> and make a new name using those 2nd letters of their names, my command
> line argument has 3 names
>
> Leoneste
> Divina
> Marcu
>
> plz help me with this one
>
> I'm trying to catch up for the class
>
> >
>

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