I am new to java hence probably a very noob question:
I have a class
public class Foo{
private static String foo;
private String bar;
public Foo(String bar){
this.bar = bar;
}
}
Now before I instantiate any object for class Foo, I want to set that static variable foo. which will be used in the class.. How do i do this?
Also, please correct my understanding. value of foo will be same across all the objects, hence it does make sense to declare it as static ? right?
private static String foo = "MyValue";Will it differ depending on run-time decisions?