0
Why my following code isn't working
class SARS { public static void main(String[] args) { void multiply() { System.out.println("Virus multiplies!"); } } } class COVID { SARS property1 = new SARS(); property1.multiply(); }
1 Answer
+ 1
A function is executed only when it is in main class.
You are trying to run multiple() function outside the main class.
Try this :-
https://code.sololearn.com/cBlif4ryd5x8/?ref=app