Friday, 4 July 2014

FINAL KEYWORD IN JAVA

final as the name suggest fixed whatever that is either the function or the variable
its a keyword used to fix the vaue of a vareable or body of a function
FINAL VARIABLE  ----->like static if fixes the value of variable which can not be changed
value is given when variable is defined
FINAL METHOD----->if we donot want to change the body of derived class then final keyword is used with base class
FINAL CLASS ---->these classes can be inherited


FINAL---------------------
import java.io.*;
import java.util.*;
class Finals
{
public static void main(String arg[])
{
final int hr=24;
System.out.println(hr);
}}



No comments:

Post a Comment