Created
August 6, 2019 12:26
-
-
Save kmizu/cacdb74ca6b55803548c283d62a819f3 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
object StringLiteralType { | |
def isAType(arg: String): Unit = arg match { | |
case _ : "a" => println("This is `a` type") | |
case _ => println("not `a`") | |
} | |
def a1 = isAType("a") | |
def a2 = isAType(new String("a")) | |
def a3 = new String("a").isInstanceOf["a"] | |
def main(args: Array[String]): Unit = { | |
println(a1) | |
println(a2) | |
println(a3) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment