Hi, you have not explained where did you want to use the final keyword. If a method is declared final then subclasses would be prevented from overriding or hiding it. It will give compile-time error. You can't declare them abstract.
It can be used as follows:
Code:
final class one
{
int a, b;
void change (int x, int y) { a += x; b += y; }
}
class check
{
public static void main(String[] args)
{
test[] p = new test[100];
for (int i = 0; i < p.length; i++)
{
p[i] = new test();
p[i].change(i, p.length-1-i);
}
}
}
Bookmarks