+ 1
if the method return no thing we can use println( v1.modifier())
https://code.sololearn.com/cDdkMMp2MjXM Thanks guys
2 Answers
+ 8
No.
The reason is because the modifier() method, being void, returns nothing at all, and hence the println method doesn't have anything to print out to the console. The JVM gives a compilation error, just for the same reason.
PS. You can just call the modifier() method AS IS.
v1.modifier();
like you've done on line 12!
0
Thanks very helpfull !