Question: public void countPets ( ) { record Pet ( int age ) { } record PetSummary ( long count, int sum ) { } var
public void countPets
record Petint age
record PetSummarylong count, int sum
var summary Stream.ofnew Pet new Pet new Pet
collectCollectorsteeing
Collectors.counting
Collectors.summingIntPet::age;
System.out.printlnsummary;
A The code does not compile since records are defined inside a method.
B The code does not compile due to the teeing call.
C PetSummary count sum
D PetSummarycount sum
E PetSummarycount sum
F PetSummarycount sum
G
The code does not compile for another reason.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
