final variable

You can specify an end variable using the reserved word final. The final variable represents a constant value that can not be changed. Typically, final variables are capitalized.

final int MAX = 100;
final int MIN = 1;

To access class variables and object property variables, use “.” As shown below.

class variable
ObjectName. ObjectPropertyVariable
object property variables
class A {
  int aa;
  int bb;
  int cc;
  static int s = 0;

class ATest {
  public static void main(String args[]) {
    A obja = new A();
    obja.aa = 4; = obja.aa * 2; = A.s;
Basic example of an end variable

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest Post