+ 2

Current context

I’m trying to initiate a method. What does it mean when an error says “Keyword void cannot be used in current context”? I’ve tried other keywords like “int”, or “static int”, but it doesn’t accept those either. It doesn’t consider it a method :/

29th Oct 2019, 7:01 PM
Spencer Rich
Spencer Rich - avatar
5 Antworten
29th Oct 2019, 9:51 PM
Spencer Rich
Spencer Rich - avatar
+ 1
You cannot declare a method in the main method. https://code.sololearn.com/c9I9id6Qc1a9/?ref=app
30th Oct 2019, 6:53 AM
sneeze
sneeze - avatar
0
Can you show use the code ?
29th Oct 2019, 9:24 PM
sneeze
sneeze - avatar
0
i tried your code and i tried modifing mine but on both there are errors and warnings- stuff like num1 is declared but never used, and it STILL has a problem with the keyword void-even if its not in the main method
30th Oct 2019, 2:13 PM
Spencer Rich
Spencer Rich - avatar
0
True. Have a look at this. https://code.sololearn.com/cpeQkO2vWefO
30th Oct 2019, 2:46 PM
sneeze
sneeze - avatar