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 a function in programming?

1100


What are the properties of thread?

969


Can a class have multiple subclasses?

1151


Why is stringbuffer not immutable?

1134


What is the java idl system?

1084


What are three advantages of using functions?

1054


What are filterstreams?

1115


How to check if linked list contains loop in java?

953


What string is utf8?

1038


How is tree Mirroring implemented?

1121


Is assembly language a low level language?

1014


Difference between string, string builder, and string buffer?

1177


how does multithreading take place on a computer with a single cpu? : Java thread

1199


what is the volatile modifier for? : Java thread

1058


What is an object's lock and which object's have locks in java programming?

1105