Explain Global variables in Packages?
Answers were Sorted based on User's Feedback
Answer / milind
i think der is no such thing global variable in java....
instance variable
local vaiable is in java
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / preetesh
There is no term as Global variable in Java.
Types of variable: 1) Local Variable declared within method.
2) Instance Variable declared within class but outside
method.
3) Class Variable
4) Parameters are also treated as variables
Example:
--------
public class Global {
public static int i = 25;
public static String s = "Preetesh";
}
//Such members can be accessed as:
public class Test {
public static void main(String[] args)
{
Global.i = Global.i + 100;
Global.s = "Java";
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anitha
expect private,all public,protected and default variables
are global in a package
Is This Answer Correct ? | 0 Yes | 1 No |
Why is whitespace important?
Program to find greatest prime number in n numbers?
How a string is stored in memory?
What is the purpose of tostring() method in java?
What are the difference between composition and inheritance in java?
What is the generic class?
what is the difference between System.exit() and System.exit(1)?
1 Answers eClinical Solutions, eClinical Works, eClinicalWorks,
What is functional interface in java example?
What are java annotations?
What are packages and name a few?
Explain Connection Pooling?
Hi ,i convert contrller as jSp And presentation as servlet ...will it do? if so what are advantage and idsadvantages