Advertisement
jtentor

Demo Date 1

Sep 13th, 2021
1,541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. //
  2. // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
  3. //
  4.  
  5. import java.util.Date;
  6. import java.util.Random;
  7.  
  8. public class Program {
  9.     // hace falta para generar números aleatorios
  10.     static Random random = new Random();
  11.  
  12.     public static void main(String[] args) {
  13.  
  14.         Integer dia;
  15.         Integer mes;
  16.         Integer anio;
  17.         Date fecha1;
  18.  
  19.         Integer count = 5;
  20.         while (count-- > 0) {
  21.             dia = random.nextInt(28) + 1;
  22.             mes = random.nextInt(12) + 1;
  23.             anio = random.nextInt(100);
  24.             fecha1 = new Date(anio, mes, dia);
  25.             System.out.println("Fecha " + fecha1.toString());
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement