• Post Reply Bookmark Topic Watch Topic
  • New Topic

Local Classes  RSS feed

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
I have two questions:
1) What are field variables ?
I have heard of class variables and local variables, which one is the field variables.

2) What are local classes ?
Is it similar to inner classes ? When an inner class is defined inside a method how does it behave differently ?

Thanks.

-Navin.
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many naming conventions for variables. Java uses "local varaible", "instance variable", and "static varaible". Sometimes an instance variable is called field or field variable, data member or member variable. Static variables are sometimes called class variables

A class definition can also contain the following four kinds of inner classes:

Member classes
Local classes
Anonymous classes
Nested top-level classes and interfaces

A local class is a class that is defined within a block of Java code. While local classes are probably most frequently defined within methods and constructors, they can also be defined inside static initializer blocks and instance initializers.


A local class is truly an inner class, because an object of the local class cannot exist in the absence of an object of the enclosing class.

Chandrasekhar S
SCJP
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!