Created
December 16, 2018 04:22
-
-
Save Ravikharatmal/b3710c1a6fa5358fa47d940bd9e5672f to your computer and use it in GitHub Desktop.
Java vs. Groovy, Scala, Kotlin - Syntax Comparison of JVM Languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Syntax: | |
<public/private/protected/internal> class <class-name> (constructor-arg-name:arg-type,..){ | |
<public/private/protected/internal> fun <func-name> (<arg-name>:<arg-type>,...) : <return-type> = { | |
<method-body> | |
return <return-value> | |
} | |
} | |
Example: | |
class MyTestClass(val name: String){ | |
fun myMethod(a: String, b: Int): String { | |
var result = name + a + b; | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment