Given: interface Rideable {Car getCar (String name); } class Car { private String name; public Car (String name) { this.name = name; } } Which code fragment creates an instance of Car?
A.
Car auto = Car ("MyCar"): : new;
B.
Car auto = Car : : new; Car vehicle = auto : : getCar("MyCar");
C.
Rideable rider = Car : : new; Car vehicle = rider.getCar("MyCar");
D.
Car vehicle = Rideable : : new : : getCar("MyCar");
Rideable is a FunctionalInterface.
Rideable rider = Car::new, assigns Car::new as rider's getCar() method.
So when you call rider.getCar() you are calling Car::new.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
6c84cb9
5 months, 4 weeks agoDarGrin
8 months, 1 week agoSyyyyyyyy
8 months, 1 week agoasdfjhfgjuaDCV
11 months agor1muka5
1 year, 10 months agoWilsonKKerll
2 years, 10 months agoM_Jawad
5 years agoadnano1234
5 years ago