I created this ArrayList and at the time of execution the following message appears:
Error: The main method was not found in class DeclarationArray.Declaracao_Array; set the parent method as: public static void main (String [] args)
Reading the message, and with the help of colleagues here in the SOPT, it is noticed that my code is missing the main method, my question is Where do I put this method? I tried in many ways, but without success.
How would my code be with this new method?
package DeclaracaoArray;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Declaracao_Array {
public String sorteia (){
List<String> lista = new ArrayList<String>();
lista.add ( "Alice" );
lista.add ( "Bruno" );
lista.add ( "Carlos");
lista.add ( "Daniel");
Collections.shuffle ( lista );
return lista.get(0);
}
}