Is a nonaccess class and member modifier.
A final class cannot be subclassed.
Final methods cannot be overridden in a subclass.
Instance final variables are not initialized by default.
Declaring a variable with the final keyword makes it impossible to reinitialize that variable once it has been initialized with an explicit value
-For primitives, this means that once the variable is assigned a value, the value can't be altered. For example, if you assign 10 to the int variable x, then x is going to stay 10, forever.
-For object reference variables, this means that a reference variable marked final can't ever be reassigned to refer to a different object.
final is the only modifier available to local variables and method arguments. Means it can't be modified within the method.
final Summary:
Class = Cannot be extended
Method = Cannot be overridden
Variable = Cannot be reinitialized
> I will take a wild guess here: maybe the OP meant
> final?
> http://java.sun.com/docs/books/jls/second_edition/html
> /typesValues.doc.html#10931
Of course he did. I was just pricking him. You need to take a look at his posting history. Lots of homework, with only lame attempts at any creative twists to the questions. ;)
> Dear all,
> What is Final variable in java ?
> Taton
What have you done to try to find the answer yourself? Did you google? No. Did you bother to look at the index of your textbook? No. Did you do anything other than post your homework and wait for others to do your work for you? No.
> > Dear all,
> > What is Final variable in java ?
> > Taton
>
> What have you done to try to find the answer
> yourself? Did you google? No. Did you bother to look
> at the index of your textbook? No. Did you do
> anything other than post your homework and wait for
> others to do your work for you? No.
I did all things
public class Finaljava {
final static int hi = 9;
public static void main(String args[]) {
Finaljava fi = new Finaljava();
//fi.hi;
//Finaljava.hi;
System.out.print(hi);
}
}
> > > Dear all,
> > > What is Final variable in java ?
> > > Taton
> >
> > What have you done to try to find the answer
> > yourself? Did you google? No. Did you bother to
> look
> > at the index of your textbook? No. Did you do
> > anything other than post your homework and wait
> for
> > others to do your work for you? No.
> I did all things
I see.
Then perhaps you might share what you found and what parts of it you didn't understand. Otherwise, anybody who might try to help you would just be repeating what you already read and did not understand. You need to provide:
a) Evidence of what you've tried so far, so that people here won't think you're just trying to get others to do your work
and
b) Details about what in (a) you are confused about, so that people can direct their answers toward the appropriate aspects of the broader question. (Note that (a) also helps with this.)