Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between var and val ?



What is the difference between var and val ?..

Answer / Gulwaiz Akhter

In Kotlin, both `var` and `val` are used to declare variables. The main difference lies in their mutability behavior: n1. `val`: A `val` is immutable and its value cannot be changed after it is initialized.n2. `var`: A `var` can be reassigned a new value after it is initialized.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Kotlin Interview Questions

What are different types of constructors in kotlin?

1 Answers  


Can you migrate the code from java to kotlin?

1 Answers  


Which method is used to get array last index?

1 Answers  


How to write string template expression?

1 Answers  


What is the difference between Const and Val?

1 Answers  


What are the different types of constructors in Kotlin?

1 Answers  


What do you mean by kotlin string interpolation?

1 Answers  


In kotlin, can we create an empty array?

1 Answers  


What is the equivalent of switch expression in Kotlin? How does it differ from switch?

1 Answers  


How can you declare a variable in Kotlin?

1 Answers  


What is the difference between inline and infix functions? Give an example of each.

1 Answers  


Who created Kotlin programming language and when?

1 Answers  


Categories