Initializing an Array by assigning them one by one: - Java Language Basics

Java examples for Language Basics:Array

Description

Initializing an Array by assigning them one by one:

Demo Code

public class Main {

  public static void main(String[] args) {
    String[] days = new String[7];
    days[0] = "Sunday";
    days[1] = "Monday";
    days[2] = "Tuesday";
    days[3] = "Wednesday";
    days[4] = "Thursday";
    days[5] = "Friday";
    days[6] = "Saturday";

  }/*w  ww  .  j a  v  a2 s. c  o m*/

}

Related Tutorials