I wrote my code but now i am trying to change to see what is happening.
In the object class field,
static final String msg="here";
And in the same object, in a methot
public void givemessage(int no)
{
System.out.println("look.");
System.out.println(msg);
}
here it gives "here" when i call from main. But
public void names(String[] names)
{
String msg=" - ";
System.out.println(msg);
}
Here when i call from main it gives -, not "here" BUt it was final static. Why did it change and why is there no compile error? Or i misunderstood all java?