In your NewName method :
[code]
char[] newName = null;
[...]
newName[i]= [whatever]
[/code]
You must allocate your array before moving things in it ;o)

Ahmet Süreyya Rifaiog(lu a écrit :
> Hi members,
> I wrote the homework of Built in Classes, but there is a problem in my 
> function(Exception in thread "main" java.lang.NullPointerException at 
> BuiltinClasses.generateNewName(BuiltinClasses.java:35) at 
> BuiltinClasses.main(BuiltinClasses.java:27)). Here is my code.
> public class BuiltinClasses {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> // TODO code application logic here
> if(args.length<3)
> {
> System.out.println("You must enter at least three names!!!");
> }
> System.out.println("Names of the family members are ");
> for(int i=0;i<args.length;i++)
> {
> System.out.println(args[i]);
> }
> generateNewName(args);
> }
> public static void generateNewName(String arr[])
> {
> System.out.println("The new name is ");
> char[] newName = null;
> for (int i=0;i<arr.length;i++)
> {
> newName[i]=arr[i].charAt(1);
> System.out.print(newName[i]);
> }
> }
>
> }
>
> 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