"David"

Here is the solution for array


public class JavaArray {
    /** Creates a new instance of JavaArray */
    public JavaArray() {
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // Declare and create int array whose size is 10
        int[] ages = new int[10];
        // Display the value of each entry in the array
        for(int j=100;j<(100+(ages.length));j++)

        for( int i=0; i<ages.length; i++ )
        {
            System.out.println( "ages" +"[" +i +"]" +"=" +(ages[i]=j++ ));
        }
    }


}

On Mon, Jul 27, 2009 at 6:46 PM, Sech21 <[email protected]> wrote:

>
> your code is:
>
> For(int a=100; a<age.length; a++){...
>
> In the first case: The letter "f" from "for" can not be Upper case.
> In the seconde case:
>  There is a problem with your statement. Your variable "a" starts in
> 100, then the condition suppose to be decreasing but you are
> increasing it.
>  You really have to revise your logic
>
> On Jul 27, 7:12 pm, "David Seto" <[email protected]> wrote:
> > This is embarrassing I can't even figure out to modify the original
> > MyJavaArrayProject.
> >
> > When I ran the program all I get is successful build.
> >
> > Same thing with debug. My modifications are displayed in green.
> >
> > Just before the for loop that prints out the value of each entry of the
> > ages[] array, create another for loop in which a value of 100 is assigned
> to
> > the first entry of the array, ages[0], 101 to the next entry of the
> array,
> > ages[1], and so on.
> >
> > public class JavaArray {
> >
> >     /** Creates a new instance of JavaArray */
> >     public JavaArray() {
> >     }
> >
> >     /**
> >      * @param args the command line arguments
> >      */
> >     public static void main(String[] args) {
> >
> >         // Declare and create int array whose size is 10
> >        int[] age=new int[10];
> >
> >        int[] ages = new int[10];
> >
> >         // Display the value of each entry in the array
> >
> >         For (int a=100; a<age.length;a++){
> >         for( int i=0; i<ages.length; i++ ){
> >             System.out.print (ages[i] );
> >
> >             System.out.print (age[a]);
> >
> >            }
> >         }
> >     }
> >
> >
> >
> > }- Hide quoted text -
> >
> > - Show quoted text -
>
> >
>

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