Capsules for recovering Scala fever.

Table of contents
Reading Time: 2 minutes

Scala is a multi-paradigm programming language that combines the features of object-oriented programming and functional programming. The word “Scala” refers to “Sca(Scalable)+la(Language)” i.e designed to grow with the demands of its users. Scala runs on the Java Virtual Machine.

Here We’ll discuss about some of the basic concepts in Scala that make it distinct from other programming languages.Let us start with some of the following:


1. Simple method in scala:-

2. Scala Array with “for” loop :-

3. Constructor in Scala:-

4. Companion Objects. :-

In Java, you often have a class with both instance methods and static methods. In Scala, you achieve this by having a class and a “companion” object
of the same name. The class and its companion object can access each other’s private features. They must be located in the same source file.

5. Bypass the main method :-
In Scala, you need not to have main method always, you can bypass the main method by extending the “App” trait as follows.

6.ArrayBuffer in Scala:-
Most operations on an array buffer have the same speed as for an array, because the operations simply access and modify the underlying array. Additionally, array buffers can have data efficiently added to the end.Array buffers are useful for efficiently building up a large collection whenever the new items are always added to the end.

Enjoiii Scala!!!! 🙂

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading