I also should have added that newName should not be a char, but a String. Stephen
On Mon, Dec 14, 2009 at 1:32 AM, Tim Hokinson <[email protected]>wrote: > Hello - I'm wondering if someone can please help, I'm a bit confused > with the homework for lab 1011. > > I understand how to pass in the names via the command line. At that > point I created a for loop and printed out the names (mostly to make > sure that they were passing correctly). I understand using another > for loop and the charAt function to grab the second letter. What I'm > not clear about is how to pass the string in a static method. I tried > looking back at one of the examples, but I keep getting errors... > > Here's what I've got so far. > > Thanks > > public class BuiltinClasses { > > /** > * @param args the command line arguments > */ > public static void main(String[] args) { > > for(int i=0; i<args.length; i++){ > System.out.println( args [i]); > } > for(int i=0;i < args.length;i++) { > char newName = args[i].charAt(1); > System.out.print(newName + ""); > } > } > > } > > -- > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected]<javaprogrammingwithpassion%[email protected]> > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- 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
