Javatpoint Logo
Javatpoint Logo

Scala this

In scala, this is a keyword and used to refer current object. You can call instance variables, methods, constructors by using this keyword.

Scala this Example

In the following example, this is used to call instance variables and primary constructotr.


101 Martin

Scala Constructor Calling by using this keyword

In the following example this is used to call constructor. It illustrates how we can call constructor from other constructor. You must make sure that this must be first statement in the constructor while calling to other constructor otherwise compiler throws an error.


Rama 100

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA