In this example we will show the method to modify class attributes in Java.
Source Code
package com.beginner.examples;
public class ModifyClassAttribute {
int a;
public static void main(String[] args) {
ModifyClassAttribute c = new ModifyClassAttribute();
c.a = 7; // modify attributes
System.out.println(c.a);
}
}
Output:
7