aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static " Watch "static " New topic
Author

static

aryan sanghvi
Greenhorn

Joined: Jun 13, 2002
Posts: 21
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

Joined: Mar 22, 2002
Posts: 1055

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

Joined: Aug 26, 2001
Posts: 7610
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.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
wood burning stoves
 
subject: static
 
Similar Threads
correct these ??
Interesting question from javacross!
Static and non static variables
JQ+ Question
doubts from the john hunt's mock test