• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Method Modifier

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i heard that combining the keyword abstract with one of the following will generate compile time error can anybody explain me why?

static
synchronized
strictfp
native

(i.e)

(abstract + (Static or synchronised or strictfp or native))
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Parameswaran,
First think about abstract method. What does it mean , it says, this method does not have an implementation at this point and may be it's implemented in the first non abstract class in the inheritance heirarchy.

Ok now comming to your point .

synchronized - this tells about the code in this block can be accessed by a only one thread.
strictfp - this tells about the code in the method follows strict float point convension.
native - this tells the code is defined some where in a native language.

But where is the code in a abstract method it has only signatures ?

Atlast comming to static method, static means class methods , so think about a class method & a abstract method.
[ March 21, 2005: Message edited by: Srinivasa Raghavan ]
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi srinivasan
i get the reason for the strictfp,synchronised,native.
but for static i didn't get the point..
can u please explain it little bit more...

can i say that since there is no class name to access the static method declaring the method with static(class method) keywork in an interface will result in compile error...
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Parameswaran,
I thought of mentioning this in my previous post itself but forgot.See static methods cannot be overriden. But it can only be hided in the subclass.
 
There is no "i" in denial. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic