answersLogoWhite

0

Local Variables

There are two types of variables based on the location of declaration

1. Instance Variables- Declared inside a class, but outside of any method's body.

2. Local Variables- Declared inside a method's body inside a class.

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

What are the native methods how do you use them?

The native modifier indicates that a method is implemented in platform-dependent code (Not Java Of Course), but often in C. There wont be any questions about how to use native methods for the exam. For now it is enough if you know that native is a modifier (thus a reserved keyword) and that native can be applied only to methods-not classes, not variables, just methods. Note that a native method's body must be a semicolon (;) (like abstract methods), indicating that the implementation is omitted.


What does public mean in java?

The keyword public is an access specifier. A variable or a method that is declared public is publicly accessible to any member of the project. Any class or method can freely access other public methods and variables of another class.


Is it possible to declare a variable in a method and use it in a main?

Yes you can and they are known as inner methods. You can even delcare an inner class and methods on it. However, if you want your classess accessible from multiple programs (reusability), then you should not use this practice. This type of facility is useful when you know for sure that your class or method is going to be used only once.


Why is it important to know the proper data types in declaring variables?

If you do not know then you cannot write a program. The compiler is not clairvoyant so it cannot do it for you.


Is it necessary to initialize accumulator variables?

If it isn't, then you don't know for sure what value it will start at in some languages. Thus, your count will be wildly inaccurate. In other languages, it will just generate an error if you forget to initialize. Two steps: 1. It is critical that variables be properly initialized. 2. Counter-variables are variables.

Related Questions

Is it True or False that Variables declared in the particular member function are know as data members and can be used in all member functions of the class?

False. Variables declared within a particular member function are local to that function, and are automatically allocated and deallocated at entry and exit of the function.


How do you solve the problems with two variables?

The analytical method involves simultaneous equations but if you do not know that, draw graphs of the equations: with one variable represented per axis. The solution, if any, is where the graphs meet.


How do you solve free fall in physics?

Usually you would use one of the formulae for constant acceleration, replace the variables you know, and solve for the variables you don't know.


When the TYBA results 2009 wil be declared?

I would like to know when the tyba result is going to be declared.


Why air jet method of texturing is specially used for regenerated fiber?

if any body know plz maill me ..danish_raja1@hotmail.com


Why is it importaint to controle variables in an experiment?

You need to control the variables because if you have two or more variables in an experiment you will never know which variable caused a change or not caused a change.


What are the native methods how do you use them?

The native modifier indicates that a method is implemented in platform-dependent code (Not Java Of Course), but often in C. There wont be any questions about how to use native methods for the exam. For now it is enough if you know that native is a modifier (thus a reserved keyword) and that native can be applied only to methods-not classes, not variables, just methods. Note that a native method's body must be a semicolon (;) (like abstract methods), indicating that the implementation is omitted.


Why is important to control variables in an experiment?

So that you can know what is the manipulating variable, the controlling variable, and the responding variable! To control the variables!


What are the variables that will affect the cost of webcast?

I want to webcast my services and the products so want to know how much will it cost and on which variables


How do you calculate sample size for survey of city having population 800000?

That depends on what you want to know, the form of the answer, how and where the survey is to be conducted and lots of other variables. Once you have all of that sorted, the best and simplest method is to consult tables or software.


The variables and numbers in a mathematical expression?

do you really expect me to know this


Why do you use letters in algebra?

To represent variables you don't know, or could be anything.