A local variable has a local scope.Such a variable is accessible only from the function or block in which it is declared.
Example of Local variable :
The class variable are declared in the class but not within methods of any
class. Whereas the local variable exits within the methods of any class. Below
two program are shown which help you to understand the difference between the
class and local variable :
Showing Local Variable
|
public class LocalVar { |
Showing the Class Variable
|
public class ClassVar { |
Java classes can be grouped together in packages. A package name is the same as the directory (folder) name which contains the .java files. You declare packages when you define your Java program, and you name the packages you want to use from other libraries in an import statement.
For More Details Click Below :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.