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

How to define a constant variable in Java?

Answer Posted / vidya bhushan dwivedi

The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the value can't be changed also.

static final int MAX_LENGTH = 50; is an example for constant.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is widening and narrowing in java? Discuss with an example.

1033


What language is pass by reference?

1007


Write a java program for binary search?

1049


Which java collection does not allow null?

1141


What is default constructors?

990


What do you mean by access modifier?

1018


How do you calculate roots in java?

1078


Explain the difference between collection api and stream api in java8?

963


What is the meaning of I ++ in java?

1172


What is the different types of functions?

1050


In java, how we can disallow serialization of variables?

987


What is a nested list?

956


Explain OOPs concept.

1077


How to create a base64 decoder in java8?

1050


How to make a class or a bean serializable?

963