java question: Is it a method?
class, java, oop, variables
Solution
Button is a constructor.
Problem
I'm no Java guy, so I ask myself what this means: ``` public Button(Light light) { this.light = light; } ``` Is Button a method? I ask myself, because it takes an input parameter light. But if it was a method, why would it begin with a capital letter and has no return data type? Here comes the full example: ``` public class Button { private Light light; public Button(Light light) { this.light = light; } public void press() { light.turnOn(); } } ``` I know, this question is really trivial. However, I have nothing to do with Java and haven't found a description for the Button thing above. I'm just interested.