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