Advertisement
Kotuara

Практика7.5

Dec 23rd, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.function.Function;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         int Positive=322, Zero=0, Negative=-12;
  9.         Function <Integer, String> Ref = i -> {
  10.             if (i==0) return "Ноль";
  11.             else if (i>0) return "Положительное число";
  12.             else return "Отрицательное число";
  13.         };
  14.  
  15.         System.out.println(Ref.apply(Positive));
  16.         System.out.println(Ref.apply(Zero));
  17.         System.out.println(Ref.apply(Negative));
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement