Page 1 of 1

[HD-OCP17/21-Fundamentals Pg 489, Sec. 17.1.6 - the-foreach-method]

Posted: Thu Oct 24, 2024 4:22 am
by raphaelzintec
hello

can you explain me this, why BiConsumer<String, Integer> accepts method having double primitive type argument and prints double not integer:

Code: Select all

... main code...

        BiConsumer<String, Integer> biConsumerMR = MyClass::showNameAge;
        biConsumerMR.accept("bob", 50);
    }
... end main...

    static void showNameAge(String name, double age){
        System.out.println(name+" "+age);
    }