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

Share This Post

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다

Latest Post