employer cover photo
employer logo

Pergunta de entrevista da empresa NetSuite

Reverse a list of int.

Resposta da entrevista

Sigiloso

7 de jun. de 2018

public static void main(String args[]) { ArrayList listOfInts = new ArrayList(); listOfInts.add("5"); listOfInts.add("6"); listOfInts.add("7"); listOfInts.add("8"); listOfInts.add("9"); System.out.println("Before Reversing : " + listOfInts); Collections.reverse(listOfInts); System.out.println("After Reversing : " + listOfInts); } } Output Before Reversing : [5,6,7 ,8 ,9 ] After Reversing : [9,8,7,6,5]