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 |
What is the use of string and stringbuffer?
What are the main uses of this keyword?
Explain the concept of polymorphism with examples?
Why arraylist is used in java?
which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com
How do you override a private method in java?
what is static import in java? Explain
What are MalformedURLException and UnknownHost Exceptions and whey they will be thrown?
What is the private method modifier?
What is the program development process?
What should I import for arraylist in java?
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?