In this example we will show the method to override existing attribute values in Java.
Source Code
package com.beginner.examples;
public class OverrideAttribute {
int i = 25;
public static void main(String[] args) {
OverrideAttribute o = new OverrideAttribute();
o.i = 17; // override existing attribute
System.out.println(o.i);
}
}
Output:
17