Basics:
def abc(a:type):String = {}
obj.abc //getter
obj.abc = pop //setter
val var:type = value
class someclass(var: type) //cant use getter or setter. need new
case class someclass(var: type) // can use getter. do not need new
Instance methods on classes
Static methods on objects
Variables created by val are immutable.
Tuples in scala:
-Fixed size of things
-Elements could be of different types
Creating a tuple: val t:(s,b) = (new s, new b)
def abc(a:type):String = {}
obj.abc //getter
obj.abc = pop //setter
val var:type = value
class someclass(var: type) //cant use getter or setter. need new
case class someclass(var: type) // can use getter. do not need new
Instance methods on classes
Static methods on objects
Variables created by val are immutable.
Tuples in scala:
-Fixed size of things
-Elements could be of different types
Creating a tuple: val t:(s,b) = (new s, new b)
Comments
Post a Comment