I will answer with an example using scalacand javap.
First I create Test.scala:
class Test {
val x = 1
var y = 2
}
Compile it with using scalac Test.scalato generate Test.class, then use javap -p Test.classto get
public class Test {
private final int x;
private int y;
public int x();
public int y();
public void y_$eq(int);
public Test();
}
So, you can see that it has val xbecome a field private finalin the class, as well as a method public finalto return this value.
var y getter + setter. y_$eq(int) - . scala def y_=(newY: Int): Unit. Scala y = someValue y_=(someValue).