Sorry, that I made a mistake on topics. Here, i think, program is rather fine. You have to write all the names from input to the output too. In other words, You have here to system.out an args array.
You bether think about "dividing presentation from logic", which means, that You don't use System.out.println in generateNewName method - instead of this, You write a method String generateNewName, which returns string containing newname. You can always build string from char array: char[] arr = new char[args.length]; ... String s = new String(arr); Dividing logic from presentation is shown in later courses ( i am talking of course about MVC pattern ) Regards Grzegorz Patynek On Aug 8, 7:24 pm, devika shukla <[email protected]> wrote: > Hi all. > i need your help in this program,in which i have to get the newname > which comprises of the second alphabet of each of the name passed > through command line arguments. > the code that I tried out is given below > > public class builtinclasses { > > /** > * @param args the command line arguments > */ > public static void main(String[] args) { > > if(args.length==0) > System.exit(0); > for(int i=0;i<args.length;i++){ > System.out.println(args[i]); > } > System.out.println("New name is: "); > generateNewName(args); > } > > // TODO code application logic here > public static void generateNewName(String[] args) > { > for (int i=0;i<args.length;i++) > { > System.out.print(args[i].charAt(1)); > } > } > } > > please help me to modify this code to get the desired result. > Thanks and 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 -~----------~----~----~----~------~----~------~--~---
