I have this line of code.
class ButtonPanel extends JPanel implements ActionListener
{
public ButtonPanel()
{
yellowButton = new JButton("Yellow");
and It works, I thought Java needs to know the type of yellowButton before creating an instance of a jButton like this?
JButton yellowButton = new JButton("Yellow");
can somebody explain how this works?