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

Differences between traditional programming language and object oriented programming language?

1072


What is the use of private static?

1012


Explain java coding standards for interfaces?

1069


Explain hashset and its features?

1091


What is classes in java?

897


Explain the private field modifier?

1037


What is a nested structure?

977


How we can generate random numbers in java?

1088


Is null in java?

956


What is methods in java?

965


What is difference between wait and notify in java?

1066


What is the significance of listiterator?

1031


Does it matter in what order catch statements for filenotfoundexception and ioexception are written?

917


What is java util list?

887


What is OOP Language?

1025