Ok, thanks. So basically we use the static keyword for two reasons. 1. to make a variable have the same value across all instances and 2. to allow variables to be used without creating an instance of...
Type: Posts; User: TP-Oreilly
Ok, thanks. So basically we use the static keyword for two reasons. 1. to make a variable have the same value across all instances and 2. to allow variables to be used without creating an instance of...
I understand that the static keyword makes a variable have the same value across all instances, but I dont understand why when I put...
import javax.swing.JOptionPane;
public class Scope2 {
...
If so, then why dont we make variables inside methods static also?
So we make class variables a static variable so that we can use it without instantiating it?
Hi, can you answer me this.
With class variables (a variable which is not declared in a body of any method), what are their scope?
And why do I have to put "public static" in front of class...