Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lab11;
- @FunctionalInterface
- interface IPodatek {
- int obliczPodatek(int stawka, int podstawa);
- }
- class Podatek{
- public static double oblicz(int stawka, int podstawa, IPodatek fun) {
- double result;
- result = fun.obliczPodatek(stawka, podstawa);
- return result;
- }
- }
- public class Main {
- public static void main(String[] args) {
- IPodatek fun = (stawka, podstawa) -> stawka*podstawa;
- System.out.println(Podatek.oblicz(23, 60000, fun));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment