• 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

Static Modifier

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, all,
I just feel confused here about this question from http://valiveru.tripod.com/java/jvaltest.html.
Question 30.
Which of the following is true about static modifier.
A.static can be applied to : instance variables, methods,
code Segments and classes.
B.a static method cannot be overridden.
C.inner classes can be both static & private.
D.a static reference cannot be made through non static
method or code block.
E.abstract & static both can be applied together to a
method.
Given Answer:BCD
Is inner class considered as class? if yes, i think choice A is also a correct answer.
thanks for advice.
arthur
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instance Variables cannot be static. Static variables are associated more with the class then with an instance of the class. Therefore A would not be correct.
 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by miceal oconnor:
Instance Variables cannot be static. Static variables are associated more with the class then with an instance of the class. Therefore A would not be correct.


Hi micel
instance variable are member variable before they become static variable. Yes, auto/local variable can not be static.
I think "class" is different from "inner class" as inner class has some properties which class do not have, like accessing private members of other class(enclosing class)
CMIW
------------------
Regards
Ravish
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic