美文网首页
Java Array

Java Array

作者: TFprime | 来源:发表于2019-03-15 10:40 被阅读0次

    学习材料

    https://joshhug.gitbooks.io/hug61b/content/chap2/chap24.html

    Array Basic

    Arrays are a special type of object that consists of a numbered sequence of memory boxes. This is unlike class instances, which have named memory boxes.

    Declaration and instantiation

    Example

    • int x; gives us a 32 bit memory box that stores ints.
    • Walrus w1; gives us a 64 bit memory box that stores Walrus references.
    • Walrus w2 = new Walrus(30, 5.6); gets us 3 total memory boxes. One 64 bit box that stores Walrus references, one 32 bit box that stores the int size of the Walrus, and a 64 bit box that stores the double tuskSize of the Walrus.

    Array Creation

    • x = new int[3];
    • y = new int[]{1, 2, 3, 4, 5};
    • int[] z = {1, 2, 3, 4, 5};

    相关文章

      网友评论

          本文标题:Java Array

          本文链接:https://www.haomeiwen.com/subject/uoxlmqtx.html