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 major advantage of external iteration over internal iteration?

1032


What are functions in java?

898


Should a main method be compulsorily declared in all java classes?

996


Can we use this () and super () in a method?

926


What are the different types of inheritance in java?

951


Can we synchronize static methods in java?

1039


What is empty list in java?

1026


What is the largest number a double can hold?

976


what is collatration?

3233


Can we increase array size dynamically in java?

897


Can we start a thread twice in java?

909


What are the limitations of procedural programming approach?

998


What is collections framework?

1100


What are the advantages of defining packages in java?

923


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

2236