简体   繁体   中英

syntax input and output (Simple java)

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.

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; 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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