I'm aware this won't work but it's just an example so I can understand why it won't work.
public class MyClass {
final static JButton b;
public void myMethod() {
b = new JButton("Hello!");
}
}
1) Why is there an error for the final static JButton b; line? And why does this error disappear when I remove the static keyword?
2) With or without the static keyword, there is an error for the line b = new JButton("Hello!"); I'm wondering why this is? I thought it would be okay to have a final variable instantiated within a method.