What are the different scopes for java variables, JAVA Programming

Assignment Help:

What are the different scopes for Java variables?

The scope of a Java variable is explained by the context in which the variable is declared. Therefore a java variable can have one of the three scopes at any given point in time.

1. Instance: - These are typical object level variables, they are initialized to default values at the time of creation of object, and remain accessible as long as the object accessible.

2. Local: - These are the variables that are explained within a method. They remain accessible only during the course of method implemention. When the method finishes execution, these variables fall out of scope.

3. Static: - These are the class level variables. They are initialized when the class is loaded in JVM for the first time and remain there as long as the class remains loaded. They are not tied to any exacting object instance.

 


Related Discussions:- What are the different scopes for java variables

Retrieving data from Excel file , how to retrieve data from Excel file, and...

how to retrieve data from Excel file, and display that data in table on jsp page?

How does java allocate heap and stack memory?, Each time an object is start...

Each time an object is started in Java it goes into the area of memory named as heap. The primitive variables like double and int are allocated in the stack, if they are local inst

Thread, what is join in java Thread

what is join in java Thread

Are constructors inherited, Are constructors inherited ? Can a subclass ca...

Are constructors inherited ? Can a subclass call the parent class constructor and When?

Program to store student record, Write a program called Grid. The program s...

Write a program called Grid. The program starts by prompting (asking) the user for the name of an input text file. This file is guaranteed to be correct and has the following fo

What is testing for equality in java, What is Testing for Equality in java?...

What is Testing for Equality in java? Testing for equality is a little trickier. You would expect to test if two numbers are equal through using the = sign. However the = sign

What is the basic difference between threads and processes? , A process is ...

A process is an execution of a code but a thread is a single execution sequence within the process. A process may contain multiple threads. A thread is sometimes named a lightweigh

Cryptoarithmatic, Create problem that solves cryptoarithmatic problem that ...

Create problem that solves cryptoarithmatic problem that uses from user using java

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd