Closed Julss799 closed 2 years ago
import java.util.Random;
public class booleans { public static void main(String[] args) { // TODO Auto-generated method stub Random numero= new Random(); boolean aleatori; //variable on es guarda boolean int numeroAleatori=numero.nextInt(2); //numeros aleatoris de 2 digits if (numeroAleatori==0){ //si es 0, sortira boolean false aleatori=false; } else { aleatori=true; //i si surt 1, sortira boolean true } System.out.println(aleatori); //mostrem per pantalla } }
import java.util.Random;
public class GeneradorBooleans {
}