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 |
Differentiate between run time error and syntax error.
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What problems will occur when you don?t use layout managers?
Is it possible to create Userdefined Unchecked Exception also?If Yes, give an example?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
Why local variables are stored in stack?
Explain the difference between comparator and comparable in java?
Can we declare an array without size in java?
Can we declare Pointer in Java?
What is non static block in java
10 Answers Emphasis, Ness Technologies,
What are the two environment variables that must be set in order to run any java programs?
how to get the max salary and name of employee from arraylist without using the Comperator or even Comparable interface?