简体   繁体   English

将用户输入存储在数组中

[英]Store user input in array

Hello all I am in need of some help with getting a users input with double[] getUserInput(). 您好,在使用double [] getUserInput()获取用户输入时,我需要一些帮助。

I know how to get a users input and storing it, but I do not know how to do it with a array and I have to use double[] getUserInput(). 我知道如何获取用户输入并将其存储,但是我不知道如何使用数组,因此必须使用double [] getUserInput()。 Can someone explain to me how to set this particular code up " double[] getUserInput() ", and what it does? 有人可以向我解释如何将特定代码设置为“ double [] getUserInput() ”,它的作用是什么?

I'm supposed to Store the user provided values into an array of doubles, and return this array to the main method. 我应该将用户提供的值存储到一个double数组中,然后将此数组返回给main方法。

Sample code to return double array 返回双数组的示例代码

    public double[] getUserInput(){
       double[] userinput = {/*double values separated by comma*/};
       return userinput;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM