Advertisement
Kotuara

Практика7.8

Dec 23rd, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Random;
  4. import java.util.function.Supplier;
  5.  
  6. public class Main {
  7.  
  8.     public static class HeavyBox {
  9.         public int weight;
  10.  
  11.         public HeavyBox(int weight) {
  12.             this.weight = weight;
  13.         }
  14.     }
  15.  
  16.     public static void main(String[] args) {
  17.         Supplier <Integer> Ref = () -> {
  18.             Random random = new Random();
  19.             HeavyBox Box = new HeavyBox(random.nextInt(1000));
  20.             return Box.weight;
  21.         };
  22.  
  23.         System.out.println("Коробка случайного размера " +Ref.get());
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement