Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.function.Function;
- public class Main {
- public static void main(String[] args) {
- int Positive=322, Zero=0, Negative=-12;
- Function <Integer, String> Ref = i -> {
- if (i==0) return "Ноль";
- else if (i>0) return "Положительное число";
- else return "Отрицательное число";
- };
- System.out.println(Ref.apply(Positive));
- System.out.println(Ref.apply(Zero));
- System.out.println(Ref.apply(Negative));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement