KnowledgeBoat Logo

Computer Applications

What is meant by a constant? Explain with an example.

Values & Data Types Java

ICSE

52 Likes

Answer

Constants or literals are the constant values used in a Java program. While writing a program, you can use some values which remain fixed throughout the execution of the program. Such values are called literals or constants.

For example, consider the statement x = x + 20;
In this statement, 20 is a constant as 20 remains the same throughout the execution of the program.

Answered By

32 Likes


Related Questions