Write a program in java to demonstrate final class?

final class Pro

{

                public void print()

                {

                                System.out.println("Hello");

                }

                public void display()

                {

                                System.out.println("India");

                }

}

class Chance extends Pro

{

                public void print()

                {

                                System.out.println("Hii");

                }

                public void display()

                {

                                System.out.println("Hindustan");

                }

                public static void main(String arg[])

                {

                                Chance x=new Chance();

                                x.print();

                                x.display();

                }

}

Final Class.PNG

, , , , , , ,

Leave a Reply