Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static

 
aryan sanghvi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a static modifier be used for local variables.
Inner class: If a class is defined in a method , it can access only
final variables declared in a method, can it still access all the
variables in the base class.
Can an interface be instantiated.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

can a static modifier be used for local variables.

In C++ yes. In Java no. A local variable in Java has no "memory".

Inner class: If a class is defined in a method , it can access only final variables declared in a method, can it still access all the variables in the base class.

Base class? You mean enclosing class, right? It depends on the context of the method. If it is a static method, only static veriables can be accessed, else it can access both static and non-static.

Can an interface be instantiated.

No, but an object reference can be of an interface type.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aryan,
Welcome to Javaranch
We'd like you to read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic