AIM: Write a program in Java to demonstrate use of final class.
FinalMainClass.java
Output
Happy Coding :)
FinalMainClass.java
class FinalClass { protected int a=200; protected int b=100; } final class FinalClassDemo extends FinalClass { FinalClassDemo() { System.out.println("The Final Class"); System.out.println("The Final Class not Inherited"); System.out.println("Final class of inherited classes"); } void add() { int c=a+b; System.out.println("Addition : "+c); } } class FinalMainClass { public static void main(String arg[]) { FinalClassDemo f=new FinalClassDemo(); f.add(); } }
Output
final class in java by practical server |
Happy Coding :)
0 Comments
Post a Comment