wraping list to string java

Solutions on MaxInterview for wraping list to string java by the best coders in the world

showing results for - "wraping list to string java"
María
23 Mar 2019
1public static void main(String[] args) {
2	try {
3        List<Character> list =  
4                Arrays.asList('c', 's', 'v'); 
5        StringBuilder sb = new StringBuilder(); 
6        for (Character chr : list) { 
7            sb.append(chr); 
8        } 
9        // convert to string 
10        String result = sb.toString(); 
11        System.out.println(result); 
12	} catch (Exception e) {
13		e.printStackTrace();
14	}
15}
16
17Output:
18csv
19