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(); }

2nd Sep 2021, 1:26 AM
Abhishek Kumar
1 Respuesta
+ 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
2nd Sep 2021, 3:11 AM
UD∆Y ∆.🇮🇳 [Inactive]