Simplified Array Initialization Expressions

C# has the following simplified array onitialization form.


using System;

class Program
{
    static void Main(string[] args)
    {
        char[] letters = { 'a', 'b', 'c', 'd', 'e' };

        int[,] rectangularMatrix =
            {
              {0,1,2},
              {3,4,5},
              {6,7,8}
            };

        int[][] jaggedMatrix =
            {
               new int[] {0,1,2}, 
               new int[] {3,4,5,999}, 
               new int[] {6,7,8}
            };
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.