Hi,

Looks to me like when you copy the args array to the arr array you are fine,
but when you go to print the values you are starting at 1 and you should
start at 0.

Thank you.

 

From: [email protected]
[mailto:[email protected]] On Behalf Of henry
joseph
Sent: Monday, August 16, 2010 2:17 PM
To: [email protected]
Subject: [java programming] javase_builtinclasses

 


Hi,

 

Even when i start with i= 0, i still dont get the exact number of names
entered on the command line..

 

here is my code:

 

 

public class BuiltInClass {

 

   

    public static void main(String[] args) {

        if(args.length!=5){

            System.out.println("please, names must be 5 on command line!!");

            System.exit(0);

        }

        String []arr = new String[7];

        for(int i = 0; i<args.length;i++)

           arr[i] = args[i];

        for(int i = 1; i<arr.length;i++)

          System.out.println(arr[i]+ " ");

          generateNewName(arr);

 

here is what i get at my output...

 

run:

george 

Hney 

Rroy 

Ayilla 

null 

null 

e 

n 

r 

Exception in thread "main" java.lang.NullPointerException

y 

        at BuiltInClass.generateNewName(BuiltInClass.java:43)

        at BuiltInClass.main(BuiltInClass.java:21)

Java Result: 1

BUILD SUCCESSFUL (total time: 3 seconds)

 

 

i still cant get my zhenny to show.. dont know why, any idea?

 


Dont look at where you fell but where you slipped!!!

 

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

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