class Example
{
                public static void main(String args[])
                {
                                int n[];
                                n=new int[5];
                                n[0]=7;
                                n[1]=4;
                                n[2]=6;
                                n[3]=9;
                                n[4]=8;
                                for(int i=0;i<5;i++)
                                                System.out.println(n[i]);
                }
}

JAVA 20 A.PNG
class Example
{
                public static void main(String args[])
                {
                                int n[]={5,7,6,8,4};
                                int x=n.length;
                                for(int i=0;i<x;i++)
                                                System.out.println(n[i]);
                }
}

JAVA 20 B
Advertisements