You had some simple mistakes and also some statements in the for loop
that don't make sense I comment those, and commented what I changed.




public class OwnBuiltInClass{

    public static void main( String[] args ){

        // Check if minimum requirements exist
        if ((args.length<3)||(args.length>6)){
            System.out.println("I need between three and six names of
members of your family please...");
            System.exit(0);
        }

        for(int counter = 0; counter < args.length; counter++){
           String strInstance = new String(counter);  //these two
statements need work go through the excersises it will help alot
           char counter=strInstance(counter).charAt(1);
           System.out.println("The new name using the second
characters is: "); //capitalize "System"
           System.out.print(char[counter]);
        }
  }
}// '}" was missing


On Apr 11, 3:42 am, Mihai DINCA <mihai.di...@free.fr> wrote:
> Hi
>
> I don't know what the error message means, but I noticed some round
> parenthesis where square brackets are needed. I think it should be:
>         ...
>         *char[ ] newName = new char[args.length]; // **
>         for(int counter = 0; counter < args.length; counter++){
>            // String strInstance(counter)=new String(counter); <- no
> need, you already has the "args"
>            // char (counter)=strInstance(counter).charAt(1);
>            *newName[counter] = args[counter].charAt(1); // ***
>            // system.out.println("The new name using the second
> characters is: ");
>            // system.out.print(char[counter]);
>            *System.out.println("Entered name: " + args[counter]); // ****
>         }
>         *String newlyGenerated = new String(newName); // ****
>         System.out.prinln("Newly generated name: " + newlyGenerated); //
> ******
>         ...
>
> *) There must be some variable that records the first character for each
> of the entered names (that are stored in the "args" array). A good idea
> is to put them in a char[]. With this declaration (*), newName is an
> array of chars and each of its elements is a char. It is instatiated to
> have the same length as the args array, because it gets as many
> characters as Strings in args.
> **) Store in the counter-th element of newName the second character
> (At(1)) of the counter-th String in args. Please notice the square
> brackets around [counter]. This is the standard syntax to access an
> element of an array. Contrary to the round parenthesis around (1). Here
> "At" is a method (function) associated to a String and 1 is the argument
> passed to the function. String is a special class, it is not just an
> array of characters.
> ***) We can println the currently used entered name. Please notice the
> capital "S" in "System". Java is case sensitive and it is sometimes
> difficult to make the difference between capital "S" and lower case "s"
> when printed with some Windows fonts. Just remember that class names
> begin with a capital letter. System (java.lang.System) is a class as
> well as String (java.lang.String), so they both begin with capital letters.
> ****) Because a String is not an array of character, we must create
> somehow a String from the array of characters we already got.
> Fortunately there is a constructor for the String class based on an
> array of characters.
> *****) It is the grate moment to print the final result.
>
> It is not the only way to do it, of course, but it seemed to me that it
> is the way you wanted to do it.
>
> Hope it helps
> mihai
>
> rob80...@aim.com a �crit :
>
>
>
>
>
> > I cannot compile my program:
>
> > public class OwnBuiltinClasses{
>
> >     public static void main( String[] args ){
>
> >         // Check if minimum requirements exist
> >         if ((args.length<3)||(args.length>6)){
> >             System.out.println("I need between three and six names of
> > members of your family please...");
> >             System.exit(0);
> >         }
>
> >         for(int counter = 0; counter < args.length; counter++){
> >            String strInstance(counter)=new String(counter);
> >            char (counter)=strInstance(counter).charAt(1);
> >            system.out.println("The new name using the second
> > characters is: ");
> >            system.out.print(char[counter]);
> >         }
> > }
>
> > due to the following error:
> > error: Class names, 'MyOwnBuiltinClassesProject', are only accepted if
> > annotation processing is explicitly requested.
>
> > Any ideas?
>
> > Thanks.
> > Rob
>
> > --
> > To post to this group, send email to
> > javaprogrammingwithpassion@googlegroups.com
> > To unsubscribe from this group, send email to
> > javaprogrammingwithpassion+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/javaprogrammingwithpassion?hl=en

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to