Write a program in Java to demonstrate the use of 'final' keyword in the field declaration. How it is accessed using the objects.
// Write a program in Java to demonstrate the use of 'final' keyword in the field declaration. How it is accessed using the objects.
public class Code13 {
final int collageCode = 621;
void display() {
System.out.println("Collage Code is " + collageCode);
} public static void main(String arg[]) {
Code13 f = new Code13();
f.display();
}
}
public class Code13 {
final int collageCode = 621;
void display() {
System.out.println("Collage Code is " + collageCode);
} public static void main(String arg[]) {
Code13 f = new Code13();
f.display();
}
}
Comments
Post a Comment