aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes final methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

final methods

Hasitha Randika
Ranch Hand

Joined: Sep 04, 2007
Posts: 50
--------------------------------------------------------------------------------
class A{
private final void method1(){
System.out.println("A");
}
class B extends A{
public final void method2(){
System.out.println("b");
}
}
class C{
public static void main(String ar[]){
new(B).method2();
}
}

here the answer is "b".can we override the final method in class A?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14104
    
  16

Note: If you notice, after posting, that you made a mistake, then you can edit your own post to correct it by clicking the button. You don't need to start a new post.

And please use code tags when you post code, so that the forum can display your code properly.

Continue in your other post.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: final methods