0

How do I declare constant variables?

17th Feb 2016, 9:56 AM
Elijah Murimi
4 ответов
+ 3
just add "final" keyword before the var declaration. After first value is assinged to that variable you cant change its constant throughout its scope eg: final int x=10;
30th Jun 2016, 5:57 AM
VISHAL KUMAR
+ 1
You put final in front of it.
21st Feb 2016, 2:35 PM
Jonas Schwalb
Jonas Schwalb - avatar
0
using let before execution
14th Jun 2016, 5:51 AM
Anshul Mishra
Anshul Mishra - avatar
0
Just using "let" instead of "var" you declare a constant than you can't change later
13th Aug 2016, 8:50 PM
pepechin
pepechin - avatar