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

Explain restrictions on using enum?

1023


What is early binding and late binding in java?

1111


How does singleton class work?

937


Java Compiler is stored in JDK, JRE or JVM?

1475


What are the basic concepts of OOPS in java?

980


Which data type is a class in java?

942


Explain aggregation in java?

931


Explain heap sort?

1052


What is the purpose of using bufferedinputstream and bufferedoutputstream classes?

1035


What is the difference between final, finally and finalize() in java?

1068


what is interface in java? Explain

917


How do you square a number?

1180


What is collection class in java? List down its methods and interfaces.

904


Can we assign null to double in java?

966


What are the three types of design patterns?

923