Answers for "what is difference between constant and final in java"

0

what is difference between constant and final in java

Constant is the concept, the property of the variable.

final is the java keyword to declare a constant variable.
Posted by: Guest on February-20-2022
0

difference between final and constant in java

class Data {
   final int integerConstant = 20;
}
public class ConstantExample {
   public static void main(String args[]) {
      Data obj1 = new Data();
      System.out.println("value of integerConstant: "+obj1.integerConstant);
      Data obj2 = new Data();
      System.out.println("value of integerConstant: "+obj2.integerConstant);
   }
}
Posted by: Guest on November-06-2021

Code answers related to "what is difference between constant and final in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language