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...

what is the difference between statis block and static
variable

Answer Posted / manikandan [ gtec,vellore ]

static variables hold only one value and static block is a
set of code. static variables and static methods are loaded
before a main method.it loads one by one in top down approach.

consider this code:

class test
{
static{
System.out.println(i);//compile error bcas top down approach
}

static int i=1;
public static void main(String[]asd)
{

}
}

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the properties class?

1147


Do I need java on my computer?

1022


what is heap memory?

1159


What is java util hashmap?

1033


Differences between external iteration and internal iteration?

1212


Which java collection does not allow null?

1211


What is an example of procedure?

1106


Is map sorted in java?

1110


What is an argument in java?

986


Why do we need hashset in java?

1094


What is a generic type?

1055


Explain working of call by reference function invoking.

1082


Which one will take more memory: an int or integer?

1283


What is prime number in java?

1042


What is collection class in java? List down its methods and interfaces.

1025