We read your photo as:
In Kotlin, how do you declare a variable that cannot be reassigned after it is initialized?
Computer Science
ScanSolve AI Answer
Answer
በKotlin ውስጥ፣ ከተጀመረ በኋላ ዳግም ሊመደብ የማይችል ተለዋዋጭ (variable) ለመግለጽ፣ val ቁልፍ ቃል (keyword) ጥቅም ላይ ይውላል።
valተለዋዋጭ አንዴ ዋጋ ከተሰጠው በኋላ ሊቀየር እንደማይችል ያመለክታል።varተለዋዋጭ ደግሞ ዋጋው ሊቀየር የሚችል መሆኑን ያመለክታል።letለተግባራት ወሰን (scoping functions) የሚያገለግል ሲሆን ተለዋዋጭ ለመግለጽ አይደለም።constደግሞ በኮምፓይል ጊዜ (compile-time) ለሚታወቁ ቋሚዎች (constants) ብቻ የሚያገለግል ነው።
ስለዚህ ትክክለኛው አማራጭ val ነው።
- Using the
valkeyword
Was this helpful?
Still stuck on this one?
Ask a follow-up, and the answer starts from this question.
Got a different question?Ask your own question
More Computer Science Questions
QIn Kotlin, how do you declare a variable whose value cannot be changed after initialization?QHow to declare a variable in Kotlin that cannot be reassigned after it is initialized. The example…QWhich Kotlin variable declarations are correct? Options: var age: Int? = 30, val name: String…QWhich of the following is a basic data type in Kotlin?QWhich of the following are correct Kotlin variable declarations? Select all that apply. kotlin //…

Handwritten Step-by-Step Solution
Get this as a handwritten image on WhatsApp — like a tutor wrote it for you.
Try on WhatsApp