Question 120 of 130 from exam 1Z0-809: Java SE 8 Programmer II

Question 120 of 130 from exam 1Z0-809: Java SE 8 Programmer II

Question

Given the code fragments :

public class Product {
String name;
Integer price;
Product (String name, Integer price) {
this.name = name;
this.price = price;

d
public void printval(){ System.out.print (name + " Price:" + price +" "); }

public void setprice(int price) { this.price = price; }
public Integer getPrice() { return price; }
List<Product> li = Arrays.asList(new Product ("TV", 1000), new Product ("Refrigerator",
2000))z

Consumer<Product> raise = e -> e.setPrice(e.getPrice() + 100);

1i.forEach (raise);

li.stream() . forEach (Product: :printVal);

What is the result?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.