在Java中,为什么Array的类的构造函数是私有的? [英] In Java why Array's class constructor is private?

查看:336
本文介绍了在Java中,为什么Array的类的构造函数是私有的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数组类的构造函数: -

Arrays Class Constructor:-

private Arrays() {}

我的问题是,那么究竟如何,我们正在创建数组的对象,如果Array的类的构造函数是私有的。
那么什么是下面的语句的含义: -

My question is that if Array's class constructor is private then how exactly we are creating an object of Arrays. Then what is the meaning of the below statement:-

int[] anArray = new int[10];

什么是上面的语句和数组的类之间的关系。

What is the relationship between the above statement and Array's class.

有关问题的任何帮助将真正appriciated。

Any help for the question will be really appriciated.

推荐答案

阵列简直就是使用数组,就像正宗公用事业类是工作的一个实用工具类,你猜对了,收藏。声明新的INT [10]是一个语言结构无关的Arrays类。

Arrays is simply a utility class for working with arrays, Just like Collections is a utility class for working with, you guessed it, collections. The statement new int[10] is a language construct and has nothing to do with the Arrays class.

这篇关于在Java中,为什么Array的类的构造函数是私有的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆