Current context | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
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