Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
   }
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #difference #final #constant #java
ADD COMMENT
Topic
Name
8+4 =