简体   繁体   English

语法输入和 output(简单 java)

[英]syntax input and output (Simple java)

New to JAVA新来的 JAVA

I have this input and this output/我有这个输入和这个输出/

import java.util.List;

input: public class Solution{ List<Integer> lenght(List<Character> inputList){ body of method}}输入: public class Solution{ List<Integer> lenght(List<Character> inputList){ body of method}}

expected output: [9,7,8]预计 output: [9,7,8]

My syntax for processing it/我处理它的语法/

List<Integer> lenghts = new ArrayList();

it says error can't find symbol for the line above.它说错误找不到上面一行的符号 My syntax is wrong (I think it's out dated, from an old tutorial)我的语法错误(我认为它已经过时了,来自旧教程)

Can someone please tell me the correct syntax for the the variable to the input and out put.有人可以告诉我输入和输出变量的正确语法吗? Thank you.谢谢你。

Simply use this thing List and ArrayList from java.util.*只需使用 List 和 java.util.* 中的 ArrayList

import java.util.ArrayList;
import java.util.List;

List<Integer> lenght(List<Character> inputList)
{
    List<Integer> li = new ArrayList<Integer>();
    return li; 
}

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

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