728x90 AdSpace

Latest Article



Arrays Example Code in Java using Loop and declaration





Java Arrays Programming Examples How to declare an array in Java? How to Code Example to print array values in Java Store value in Array and how to print value in array in java code

public class ArraysExample {
     public static void main(String[] args) {
        //Arrays Declaration
        int[] firstArray;
        firstArray = new int[3];

        int[] secondArray = new int[10];

        //Store value in Arrays 
        for(int i = 0; i < firstArray.length; i++){
            firstArray[i] = i;
        }
     
        //Print value in Arrays
        System.out.println("firstArray contents");

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


no image
  • Title : Arrays Example Code in Java using Loop and declaration
  • Posted by :
  • Date : 10:16
  • Labels :






  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment