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?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is your platform?s default character encoding and how to know this?

2318


What are the legal operands of the instanceof operator?

954


What about method local inner classes or local inner classes in java?

1002


explain the concept of virtual method invocation in polymorphism in detail?

2154


What are the two ways in which thread can be created?

998


What is an empty class? What functionality does it offer in Java?

1199


How to find the largest value from the given array.

962


What is the difference between jdk, jre, and jvm?

1031


Which container method is used to cause a container to be laid out and redisplayed in java programming?

1049


Which variable is the independent variable?

924


Is singleton class thread safe?

948


What is primitive array?

852


What is the difference between iterator and list iterator?

964


What’s meant by anonymous class?

1018


What is ph and buffers?

936