I'm trying to declare and initialize local String variable as static , but there is a compilation error showing Illegal modifier static. Why is it so?
Here is my code:
public class StringInstance {
public static void main(String[] args) {
static String s = "a";
if(s instanceof String){
System.out.println("Yes it is");
}
}
}