Programming with Paramerters (SOLVED) [Answered]
I have programmed for a few years now, and just figured that I can make cleaner code with Parameters. I try but I don't know what I am doing wrong
6 Replies
Well,
numbers
is a non-static method
Main
is static
Non-static methods require an instance of an object
Unless they're called in some other method of the same class
One that isn't static, since static members have no direct access to non-static ones
Either:
a) Make your numbers
static (and name it properly while at it)
b) Instantiate the class and call numbers
on that instance
c) Create a non-static Main
of sorts in a separate classOh! That's awesome, thanks for the explanation and the possible solutions ^^
It works perfectly now, I don't know why I din't use parameters before, it's amazing
Methods and parameters are one of the basics of the language, any programming language really. I'm amazed you managed without them lol
Yeah me too, no wonder why my code always was longer and more complicated than my colleagues
Must be a pain to read and understand my code
You can use
/close
command to close a thread✅ This post has been marked as answered!