what do the square brackets mean? in Java

白昼怎懂夜的黑 提交于 2019-11-30 20:18:51

Square brackets [] would indicate an array. In your case of code:

public double[] MethodName(){ .... }

You have a public method MethodName which returns an array. Double indicates what type the array is, i.e. stores an array of objects of type double.

EDIT: Forgot about answering your return question. But for your line of code, MethodName would return an array of type double (which would depend on the implmentation inside the method body). Hope that helps (I'm new to Java too; climbing the SO rep ladder)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!