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 treeset in java collection?

962


How do you change an int to a string?

996


What is the purpose of using break in each case of switch statement?

1025


What is xslt in java?

972


Why doesn't the java library use a randomized version of quicksort?

993


What is a two-pass assembler?

1049


What are wrapper classes in java?

1058


Can we override the static method?

1021


What is jrmp?

960


What is formatted output in java?

960


What ide should I use for java?

1023


How big is a gigabyte?

1027


Can you sort a list in java?

978


What is the biggest integer?

1046


What do you understand by java?

973