Local Variable and Instant Variable

Ads
 

Local Variable and Instant Variable

difference between Local Variable and Instant Variable

View Answers

February 21, 2011 at 1:11 PM

Difference between local variable and instance variable

  1. Instance variable is declared within a class but not within a method, while a local variable is declared within a method.

  2. Instance variable get a default value, so if they are used before initializing them, then also they compile fine. But in the case of local variable in Java, local variable in Java do not get an initial value, so if you use them in your code without initializing them, then you will get a compile time exception.

Ads









Related Tutorials/Questions & Answers:
Local Variable and Instant Variable
Local Variable and Instant Variable  difference between Local Variable and Instant Variable   Difference between local variable... a method, while a local variable is declared within a method. Instance variable get
What is a local, member and a class variable?
What is a local, member and a class variable?   Hi, What is a local, member and a class variable? thanks
Advertisements
I want to store the value of local variable into Global variable
I want to store the value of local variable into Global variable    <%=cnt%>=x; is it a valid Statement
ModuleNotFoundError: No module named 'Local-Variable-Manager'
ModuleNotFoundError: No module named 'Local-Variable-Manager'  Hi...: No module named 'Local-Variable-Manager' How to remove the ModuleNotFoundError: No module named 'Local-Variable-Manager' error? Thanks   Hi
Creating a Local Variable in JSP
Creating a Local Variable in JSP     ... consider a situation where we have to declare a variable as local, then we should... or variable we usually declare it inside the declaration tag. If we declare
Creating a Local Variable in JSP
Creating a Local Variable in JSP      In jsp when we have to create a method or variable we usually declare... to declare a variable as local, then we should declare the methods and variables
please tell me the difference between local variable, staitic variables, and instance variables....
please tell me the difference between local variable, staitic variables, and instance variables....  please tell me the difference between local variable, staitic variables, and instance variables
Converting jsp variable to java variable
Converting jsp variable to java variable  Hi how to convert java script variable to java variable on same jsp page
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
final variable
final variable  Please give some easiest and understanding example program for final variable
environment variable
environment variable  what are the environment variable is need to run j2ee application in eclipse could you explain the details
environment variable
environment variable  what is environment variable in java?   Environment variables are used by the Operating System to pass configuration information to applications
Static Variable
Static Variable  What is the basic use of introducing static variable... that a certain object/variable is resident in memory and accessed each time an instance..., it means that the static variable is shared among all instances of the class
Application Variable
anyone show a simple sample code of storing the connection data in a variable so
how to assign javascript variable value to a jsp variable
how to assign javascript variable value to a jsp variable  how to assign javascript variable value to a jsp variable
global variable in objective c
global variable in objective c  Declaring global variable in objective c
Instance variable in java
in java, they are as follows : Local variable Instance Variable class...Instance variable in java In this section you will learn about Instance variable in java. In java all variable must be declared before they are used
how to inherit static variable
how to inherit static variable   how to inherit static variable or methods in Java?? Please explain the entire process of inheriting the variable. Thanks in advance
variable function in php
variable function in php  Can any one tell me how to write a variable function in PHP?   Go through the PHP Variable function tutorial ... PHP Variable Function
variable function in php
variable function in php  Can any one tell me how to write a variable function in PHP
STATIC VARIABLE DECLARATION
STATIC VARIABLE DECLARATION  why cannot the static variable declare inside the method
variable declaration in c and c++
variable declaration in c and c++  Comparison and an example of variable declaration in C and C
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
What is use of a abstract variable?
What is use of a abstract variable?   Hi, What is use of a abstract variable? thanks
What is use of a abstract variable?
What is use of a abstract variable?   Hi, What is use of a abstract variable? thanks
What is instance variable in Java?
What is instance variable in Java?  Hi, What is instance variable in Java? What is the use of instance variable? Thanks   Hi, In Java programming classes are used as base of Object oriented programming. Any variable
ModuleNotFoundError: No module named 'variable'
ModuleNotFoundError: No module named 'variable'  Hi, My Python... 'variable' How to remove the ModuleNotFoundError: No module named 'variable... to install padas library. You can install variable python with following
if variable is null php
if variable is null php  How to check if submitted variable is null in PHP? Thanks!   Check if Variable is NULL in PHP You can use isset($var) to check if the variable is not defined or null in PHP. and after setting
Declare Reference variable
variable static int b; // static variable A ref; static... followed here... } } My Question is that instance variable occupy space in memory when object is created. Static variable is class variable which
Create Session Variable PHP
Create Session Variable PHP  hi, Write a program which shows the example of how to create session variable in PHP. Please suggest the reference... session Variable in PHP. May be this reference will solve your query. Thanks
creating a global variable with php
creating a global variable with php  Is it possible to create a variable to declare as global in case of database connectivity?   Yes, if you want to have access of that variable anywhere in the program. See the example

Ads