This is sample reference example, for what I am looking Solution
Reference Example:
- Here demoName is global variable
- Somehow I need to define that variable on Class level which is :
String demo = demoName;
Now it needs to override variable value with local variable, when it call from local method.
void test(String name) { demoName = name; System.out.println("Local Value:" + demoName); System.out.println("Global Value:" + demo); }
Here demoName becoming override with parameter value, But when +demo is taking class level value which is XYZ, I want it to be abc.
class demo1 {
public static String demoName = "xyz";
}
public class demos extends demo1 {
String demo = demoName;
void test(String name) {
demoName = name;
System.out.println("Local Value:" + demoName);
System.out.println("Global Value:" + demo);
}
@Test
public void testtest() {
test("abc");
}
}
I want both value to be "abc" .