• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

final class

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
1)final methods are not overridden.
2)A final class makes all of its methods final as well.
1) is understood.
2)is this implicit to us, pls let me know what it really means. i have written to myself a program in which class is final and it has a non-final method, if the 2) is right, how will i now that method a() became final.

Eg. Of final classes : Integer,Float,Long,Double,String in java.lang
Integer is a final class in java.lang, but i see its some of its method, they are not final..
public static int parseInt(String s,
int radix)
throws NumberFormatException
public byte byteValue()
public int hashCode()
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
srinivas,
When you declare a class as final, it implicitly makes its methods final. a final class cannot be sub classed, therefore, you cannot override it's methods and so by definition, the methods are implicitly final.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic