using java Arrays Create a Class to store 100 integers in an

using java

(Arrays) Create a Class to store 100 integers in an Array. Call your class “SimpleArray”, and store it in a file called “SimpleArray.java”. All code should go in the main() method. First declare an array of 100 integers. Use a for loop to store the numbers between 500 and 599 in the array. Then build a second loop to print out the data in this array.

Solution

/* package whatever; // don\'t place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be \"Main\" only if the class is public. */
class SimpleArray
{
   public static void main (String[] args) throws java.lang.Exception
   {
       // your code goes here
       int arr[]=new int[100];// declaration and instantiation of array
       int i;
       for(i=500;i<=599;i++)
       {
           arr[i-500]=i;
       }
       for(i=0;i<=99;i++)
       {
           System.out.println(arr[i]);
       }
   }
}

using java (Arrays) Create a Class to store 100 integers in an Array. Call your class “SimpleArray”, and store it in a file called “SimpleArray.java”. All code

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site