Scala App trait with DelayedInit.
Ok, Let’s start discussion about the App trait uses in our code segment. Here I will try to demonstrate some use cases for the better use of App trait in our scala code. To read more about the App trait you can refer to the documentation here
Let’s go with our daily uses of App trait 🙂
Just want to print something on console:
In the code above, we are inheriting the main method of App. We can do this also to print the same:
Output for the both : Hello Scala!
Now let’s try in advance way:
What do you think is going to be the output of this code block? If you answered
world! you are not correct. Because the output is Welcome to SCALA world!
Nothing special in above code block. I have just overridden the delayedInit method of DelayedInit marker trait. This method is normally never…
View original post 245 more words