Are constants declared the same way as variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Are constants declared the same way as variables?

30th Aug 2017, 4:57 PM
Yuko
Yuko - avatar
5 Answers
+ 7
constants are declared by using the keyword "final" e.g. final int x = 5; here the value of x remains constant throughout the code
30th Aug 2017, 5:06 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 6
@valery...I'm not any God๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚.....stop kidding and by the way...you can put the beer relative to itself i.e. anywhere you like๐Ÿ˜‰๐Ÿ˜‰๐Ÿ˜‰
31st Aug 2017, 12:20 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 3
The time for challenges is pressed:-((( I don't have time to calculate:-((( Who faced this problem? Or the higher the level, the less the time???
31st Aug 2017, 7:25 AM
Val๐Ÿฏ
Val๐Ÿฏ - avatar
+ 2
In php define("MYVAR", 3,14159265), where MYVAR is a name and 3,14 is a value; echo MYVAR, no $ sign:-) How are u doing, ChiragGod? Where to put the beer? Relative to u or your cat, dog:-D? Yeah, relative to me๐Ÿ˜
30th Aug 2017, 10:17 PM
Val๐Ÿฏ
Val๐Ÿฏ - avatar
0
what are you talking about? O_o
31st Aug 2017, 2:32 AM
Yuko
Yuko - avatar