I'm having trouble understanding this question, and the explanation of the answer for an SCJP 1.6 self test question. Here is the problem:
class A { } class B extends A { } public ...
I am trying to get an array to take a variable number of objects as input. I am new to programming so I apologize in advance. Here is my code:
public class Rating{ ...
This is puzzling me and I would like an explanation.
public foo(EventPoint... eventPoints) { //... } boolean isThisHappening; foo(isThisHappening ? new EventPoint() : new EventPoint[]{});
foo(new EventPoint());
foo(new EventPoint[]{});
Wow! I have just realized that varargs methods in Java cause an array to be allocated when they are called. Not sure why I would expect anything different, but should there ...