Tell us what’s happening:
Write Your First C# Method, all answers are wrong. The question is: Which of the following correctly declares a method?
- DisplayNumbers();
- void DisplayNumbers{};
- void DisplayNumbers() {}
1 does not have a return type. 2 does not have parenthesis. 3 has a function body {} so it is technically a method definition (not a declaration) A correct method declaration is : void DisplayNumbers();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Challenge Information:
Create Methods in C# Console Applications - Write Your First C# Method