英文:
syntax input and output (Simple 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}}
expected output: [9,7,8]
My syntax for processing it/
List<Integer> lengths = 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.
英文:
New to 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}}
expected 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.
答案1
得分: 1
import java.util.ArrayList;
import java.util.List;
List
{
List
return li;
}
英文:
Simply use this thing List and ArrayList from java.util.*
import java.util.ArrayList;
import java.util.List;
List<Integer> lenght(List<Character> inputList)
{
List<Integer> li = new ArrayList<Integer>();
return li;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论