Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication8;
- import java.util.Arrays;
- import java.util.Random;
- /**
- *
- * @author Fabs
- */
- public class JavaApplication8 {
- static Integer[] numbers = new Integer[5];
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Random preguntaAzar = new Random();
- //
- for(int i = 0; i < 5; i++) {
- int pregunta = preguntaAzar.nextInt(5);
- System.out.println("Random es:"+pregunta);
- while(Arrays.asList(numbers).contains(pregunta)) {
- pregunta = preguntaAzar.nextInt(5);
- System.out.println("Num:"+pregunta);
- }
- numbers[i] = pregunta;
- if (pregunta == 0) {
- System.out.println("Se ejecuto la 0");
- } else if (pregunta == 1) {
- System.out.println("Se ejecuto la 1");
- } else if(pregunta == 2){
- System.out.println("Se ejecuto la 2");
- } else if(pregunta == 3){
- System.out.println("Se ejecuto la 3");
- }else if(pregunta == 4){
- System.out.println("Se ejecuto la 4");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement