1. Immutable data & Pure Functions -
Scala Constructs -
Scala uses val keyword to declare the variable, which is immutable declaration.
Pure functions don't read value from the external world, they don't modify the data, instead produce the new value
Java Constructs -
Java uses final keyword to declare the variable reference as Immutable, i.e once the value is assigned to the variable it cannot be reassigned.
Lombok - https://projectlombok.org/features/val , val was introduced in lombok that gets replaced to final var
Java is the Strict type language, i.e. we need to declare the data type of the variable, In Java 10, var keyword was introduced that automatically detects the data type
example var name = "Rohit";
Comments
Post a Comment