A is correct because the void keyword means the method will not return any data.
C is correct because the data type of the variable to be returned must precede the method name.
B and D are incorrect.
B is incorrect because void is not optional if the method isn’t returning anything. The void keyword must be included in this condition.
D is incorrect because a method must always declare a return type or void. If it is a constructor, it can omit a return type and it will be implied as void.
|