Created
January 1, 2022 15:46
-
-
Save arsalankhan994/eb0a23b42ddd250410c7dc731afebba2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun main() { | |
val methodInKotlin = MethodInKotlin() | |
methodInKotlin.methodWithoutReturnTypeAndNoParameter() | |
val first = methodInKotlin.methodWithReturnTypeAndNoParameter() | |
println("return type of methodWithReturnTypeAndNoParameter: $first") | |
methodInKotlin.methodWithoutReturnTypeWithParameter("Erselan Khan") | |
val second = methodInKotlin.methodWithReturnTypeWithParameter("Erselan Khan") | |
println("return type of methodWithReturnTypeWithParameter: $second") | |
} | |
class MethodInKotlin { | |
fun methodWithoutReturnTypeAndNoParameter() { | |
println("called method methodWithoutReturnTypeAndNoParameter") | |
} | |
fun methodWithReturnTypeAndNoParameter(): String { | |
return "Erselan Khan" | |
} | |
fun methodWithoutReturnTypeWithParameter(name: String) { | |
println("called method methodWithoutReturnTypeAndNoParameter, Print my name: $name") | |
} | |
fun methodWithReturnTypeWithParameter(name: String): String { | |
return name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment