Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners STATIC VARIABLE DECLARATION

Have Programming Question? Ask it here!
 
 
 


velumekaladevi
STATIC VARIABLE DECLARATION
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


why cannot the static variable declare inside the method


Advertisement
View Answers

February 11, 2011 at 4:22 PM


Static variables are class level variables. Static means one per class as per OO rules and method level variables scope is with in the method. So java does not allow static variable to be declared inside a method.



Related Tutorials/Questions & Answers:
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
Advertisements
Static Variable
Static Variable  What is the basic use of introducing static variable type in java?Please explain clearly....   The Static means..., it means that the static variable is shared among all instances of the class
static variable in php
static variable in php  How can i call a global variable as a static variable
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
What is the importance of static variable?
What is the importance of static variable?  hi, What is the importance of static variable? thanks
Serialize the static variable
Serialize the static variable  hello, Can we serialize the static variable?   hii Yes we can serialize the static variable. if u don't want to serialize, u need to declare the variable as transient
Static variable in java
Static variable in java. Static is a keyword in java used to create static methods, variable inside a class and static class. Static variable is also called class variable which belongs to class not to object. Static
Can we declare a static variable inside a method?
Can we declare a static variable inside a method?   Hi, Can we declare a static variable inside a method? thanks
non static variable cannot be referenced from static context
non static variable cannot be referenced from static context  public... "non static variable cannot be referenced from static context". How to solve... public static void main(String []s){ Add a1=new Add(); a1.add(7,8
non static variable cannot be referenced from static context
non static variable cannot be referenced from static context  public class Add{ int foo=7; int bar=8; public int add(int x,int y... public static void main(String []s){ Add a1=new Add(); a1.add(7,8
PHP Static Variable and Methods
PHP Static Methods and Variables: In this tutorial we will study when we should use static methods and variables. Static keyword is used to make only one copy of the variable for the class. All objects of that class will access one copy
Example of a class variable (static variable)
Example of a class variable (static variable)   ... you can define the static class variable in a class. When a number of objects... of a static variable first of all create a class StaticVariable. Define one static
Java static method example
Description: Static variable are used within the static method. Non static variable do not exits in the static method. Static variables are shared by its class instances. Static variable can be used without using the instances
Declaration tag
Declaration tag   Defined Declaration tag in JSP    Declaration in JSP is way to define global java variable and method. This java variable method in declaration can be access normally. Normally declaration does
static
static  What is the exact need of declaring a variable as static?   A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value
static
static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory... is applied to member variables, it means that the static variable is shared among all
static
redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1...); **//here i have redeclared the static variable as "25" is it possible,then what
JSP Declaration
JSP Declaration  What is a JSP Declaration?. Explain it.   Hi, The answer is: The JSP declaration used to craete one or more variable and methods that are used later in the jsp file. If you want to create variable
STATIC
STATIC  WHAT IS STATIC BLOCK?EXPLAIN , AND WHAT IS THE DIFFERENCE BETWEEN STATIC BLOCK AND STATIC METHOD?   A STATIC block is automatically... between static block and static method: static block will execute when ever
DECLARATION IN JSP
DECLARATION IN JSP In this Section, we will discuss about declaration of variables & method in JSP using declaration tags. Using Declaration Tag, you... declaration with a semicolon. The declaration must be valid in the Java
static
Static Concept  in what are all the situation we may use static...,then use static blocks and without creation of object we need to perform some task,then go for static methods. If we want variables those values will not be changed
Static
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
array declaration
array declaration  what is the difference between declaration of these two things integer[] i={1,2,3,4,5} and integer i[]={1,2,3,4,5
array declaration
array declaration  String propArray = []; is this declaration correct?   Hi Friend, No, This is the wrong way. Array is declared in the following way: String arr[]={}; For more more information, visit the following
Creating a Local Variable in JSP
or variable we usually declare it inside the declaration tag. If we declare it inside the declaration directive then then the scope of the variables...Creating a Local Variable in JSP     
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 it inside the declaration tag. If we declare it inside the declaration directive
static keyword in java
method, static variable. A static keyword points the following: static methods. static variable.  static methods:- static method are unique... of static method:- <class-name>.<method-name> static variable
PHP Variables Static
PHP Variables Static PHP static variable is used to remember the value... is running a static variable is only retained by the function , but it is NOT shared.... If you noticed, we mentioned static statement before the $text variable within
Example of a instance variable
variable in a main method. If we try to call the non-static method in the main method then the compiler will prompt you that non-static variable cannot be referenced from a static context. We can call the non-static variable by the instance
track array declaration
track array declaration  how to track an array declaration in a input program
Static keyword in public static void main
example for this?   The static variable is declared by using static keyword. Following is an example of static declaration: static int i=10; The variable declared with static keyword is called class variable. This variable
Array Declaration
Array Declaration     ... that helps you in Understanding Array Declaration. For this we are using JavaScript... that include variable array, that is used to instantiate an array object
static functions
)It is a variable which belongs to the class and not to object(instance). 2)Static...)A single copy to be shared by all instances of the class. 4)A static variable can...static functions  Give some brief defenition for 1. Static Variables
static keyword
instances of the class. 4)A static variable can be accessed directly by the class name...static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared
Instance variable in java
. The basic form of variable declaration is : type identifier = value; The type...; // declaring three variable of type int a,b and c double pi=3.14; // declaration.../static variable Instance variable : Instance variable are declared
Namespace Declaration
Namespace Declaration: The term namespace is very much common in OOP based language, basically it is a collection of classes, objects and functions. Namespaces are one of the new feature in PHP 5.3.0. Naming collision of classes
static in java
static in java  what is the need to go static? what use
Static method
Static method  what is a static method?   Have a look at the following link: Java Static Method
Local Variable and Instant Variable
Local Variable and Instant Variable  difference between Local Variable and Instant Variable   Difference between local variable and instance variable Instance variable is declared within a class but not within
static methods
static methods  why static methods cannot read or write the instance variables
static method
static method  Give some absolute examples and definition for static method also
Static
Static       Static... an instance of a class. Static methods are implicitly final method, since overriding depends on the type of the object, and static methods are attached to a class
static keyword
static keyword  Hii, In which portion of memory static variables stored in java. Is it take memory at compile time? thanks deepak mishra
private static final
private static final  Why there is necessary to make a variable private static final
Static Method in PHP - PHP
Static Method in PHP  So far I can easily use the normal functions as variable in PHP? but how can use static method?  Hi Friend, Please...-static-variable-method.html Thanks
static & instance - Java Beginners
static & instance  what is different between static variable and instance variable .? plz explain with example. and when we can use static variable and when can use instance variable.    public class Main
static object array
static object array  static object array   Dynamically call a static variable array class Blog { public static $template = array('content' => 'doodle'); } Blog::$template['content'] = 'bubble'; $class = 'Blog
Java variable
Java variable   To what value is a variable of the String type automatically initialized
 

 

 

DMCA.com