mention the types of variables in scala? And what is the difference between them?
Answer Posted / Chandrajeet Verma
In Scala, there are three main types of variables: Val, Var, and Def. nnVal: It is a constant variable that cannot be reassigned after being initialized.nVar: It is a mutable variable that can be reassigned multiple times.nDef: It is a shortcut for lazy variables (val with a delayed initialization).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers