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

If try block is successfully executed, Then Is Finally block executed?

1037


What is difference between array and arraylist in java?

933


Explain a few methods of overloading best practices in java?

920


What is primitive data type in java?

911


What is final keyword in java?

969


What is difference between string and new string?

971


What is meant by main method?

997


Explain the difference between static and dynamic binding in java?

1017


What is the purpose of static methods and variables?

987


How will you print number in reverse (descending) order in BST.

943


What is the best definition for data?

923


What is static import in java?

940


What is the difference between equals() and?

1115


Explain the difference between a Thread and a Process.

940


Explain implementation and how is it different from conversion?

1018