Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
programmiersprachen:scala [2015/10/10 22:31] – [for loop] phreazer | programming_languages:scala [2017/02/19 15:46] (current) – ↷ Seite von programmiersprachen:scala nach programming_languages:scala verschoben phreazer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Scala | + | ====== |
- | **Sca**lable **la**nga | ||
- | ====== Start ====== | + | **Sca**lable **la**nguage |
+ | |||
+ | ===== Start ===== | ||
* No primitive types, everything is an object | * No primitive types, everything is an object | ||
Line 12: | Line 14: | ||
- | ===== Hello World ===== | + | ==== Hello World ==== |
<code scala> | <code scala> | ||
object HelloWorld { | object HelloWorld { | ||
Line 62: | Line 64: | ||
</ | </ | ||
- | ==== Singleton objects ==== | + | ===== Singleton objects |
There are no static methods/ | There are no static methods/ | ||
Line 76: | Line 78: | ||
</ | </ | ||
- | ==== Companion object ==== | + | ===== Companion object |
Prerequisite: | Prerequisite: | ||
- | ==== Case classes ==== | + | ===== Case classes |
* Use a factory method for construction | * Use a factory method for construction | ||
Line 93: | Line 95: | ||
</ | </ | ||
- | ==== Inheritance ==== | + | ===== Inheritance |
- | Scala don' | + | Scala doesn' |
class B(arg:Int) extends A {} | class B(arg:Int) extends A {} | ||
Line 104: | Line 106: | ||
- | === Abstract classes === | + | ==== Abstract classes |
Difference to Traits: Abstract classes can have constructors. A class which inherits from an abstract class can't inherit from another. | Difference to Traits: Abstract classes can have constructors. A class which inherits from an abstract class can't inherit from another. | ||
Line 110: | Line 112: | ||
The usage of override is optional. | The usage of override is optional. | ||
- | === Packages object === | + | ==== Packages object |
Objects which are visible in a whole package. | Objects which are visible in a whole package. | ||
Line 116: | Line 118: | ||
- | === Identity and equality === | + | ===== Identity and equality |
==-Operator checks equality (identity in Java) | ==-Operator checks equality (identity in Java) |