Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Explain about global variables in Java?

Answers were Sorted based on User's Feedback



Explain about global variables in Java?..

Answer / ravikiran(aptech mumbai)

global variables are declared globally and not inside any
method.
They are applicable to all the parts of the class

Is This Answer Correct ?    11 Yes 1 No

Explain about global variables in Java?..

Answer / satish

Direct global variables are not possible like

int i=0;
class{
....
....
}

But other way is create a class with static variables and
you can use it wherever needed.

class Global{
public static int i;
public static String s="";
}

class SomeClass{
public static void main(String args[]){
Global.i=23;
Global.s="Whats up"
}
}

Is This Answer Correct ?    6 Yes 2 No

Explain about global variables in Java?..

Answer / niranjanravi

Global variables are not possible in java because the
concept of Encapsulation is eliminated here.it is not in
the main() method where we declare variables.

Is This Answer Correct ?    5 Yes 8 No

Post New Answer

More Core Java Interview Questions

What are abstract methods in java?

0 Answers  


What is an abstract class?

8 Answers   DBS, Wipro,


Can we declare a class as abstract without having any abstract method?

0 Answers  


What is the top class of AWT event hierarchy?

5 Answers  


How many types of methods are there in java?

0 Answers  


Difference between Linked list and Queue?

0 Answers   Virtusa,


when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)dopost() d)service

4 Answers   Accenture,


What is a subsequence of a string?

0 Answers  


jdbc drivers?

8 Answers   Wipro,


what are variables in java

7 Answers   Wipro,


What is the platform?

0 Answers  


What is the set interface in java programming?

0 Answers  


Categories