Explain Global variables in Packages?

Answers were Sorted based on User's Feedback



Explain Global variables in Packages?..

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

Explain Global variables in Packages?..

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

Explain Global variables in Packages?..

Answer / therathna

for what package r u asking

there is no meaning for Global variables in Packages

Is This Answer Correct ?    0 Yes 1 No

Explain Global variables in Packages?..

Answer / anitha

expect private,all public,protected and default variables
are global in a package

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

How many threads does a core java have?

0 Answers  


How is treeset implemented in java?

0 Answers  


Can a main method be declared final?

0 Answers  


Explain Event handling in AWT?

1 Answers   Infosys, TCS,


Why const and goto are reserved keyword in java?

1 Answers  






What's the default access specifier for variables and methods of a class?

0 Answers  


What is a consumer in java?

0 Answers  


Does a class inherit the constructor of its super class?if it does, how can you hide that constructor? if it doesnot how can you call it from the sub class?

2 Answers  


Can we sort set in java?

0 Answers  


Can Exception handling we can handle multiple catch blocks?

0 Answers   PUCIT,


What is the difference between size and length in java?

0 Answers  


What is primitive data type in java?

0 Answers  


Categories