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 val and var in Scala?



What is the difference between val and var in Scala?..

Answer / Prakash Kumar Rathaur

In Scala, val and var are used to declare variables. The main difference lies in their immutability: val declares a constant that cannot be reassigned, while var can be reassigned. Once assigned, the value of a val remains unchanged throughout its lifetime, whereas the value of a var may change multiple times.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Scala Interview Questions

How to declare a function in scala?

1 Answers  


What is the difference between val and var in Scala?

1 Answers  


What is an anonymous object in scala?

1 Answers  


What do you understand by apply and unapply methods in scala?

1 Answers  


What are the major differences between Scala’s Auxiliary constructors and Java’s constructors?

1 Answers  


Is Scala a Pure OOP Language? or Java a Pure OOP Language?

1 Answers  


What is an array in scala?

1 Answers  


Please explain closure is scala?

1 Answers  


What is the difference between Java’s 'If..Else' and Scala’s 'If..Else'?

1 Answers  


What is 'Application' in Scala or What is Scala Application? What is 'App' in Scala? What is the use of Scala’s App?

1 Answers  


What do you understand by an implicit parameter in scala ?

1 Answers  


What is the difference between :: and #:: in scala?

1 Answers  


Categories