final int prime = 31; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

final int prime = 31;

Shoudnt the variable prime be capitalised due to the final keyword?

11th Oct 2017, 3:08 AM
Rick Theodore
Rick Theodore - avatar
3 Answers
+ 20
"final" use to declare a constant and you can set name of constant same as variable. ex: final int PRIME=31;
11th Oct 2017, 3:13 AM
Nithiwat
Nithiwat - avatar
+ 8
You're right it's just a convention but not compulsory for someone who didn't care about the standard.
11th Oct 2017, 3:22 AM
Zephyr Koo
Zephyr Koo - avatar
+ 5
Be cool and Follow dem standards!! 😎
11th Oct 2017, 3:36 AM
Rrestoring faith
Rrestoring faith - avatar