class Demo001[K,V] {
def show(k:K,v:V)={
println(s"$k $v")
}
}
object Demo001{
def main(args: Array[String]): Unit = {
val demo=new Demo001[Int,String]
demo.show(1,"cc")
val demo2=new Demo001[Int,Int]
demo2.show(10,20)
}
}
class Demo001[K,V] {
def show[T](k:K,v:T)={
println(s"$k $v")
}
}
object Demo001{
def main(args: Array[String]): Unit = {
val demo=new Demo001[Int,String]
demo.show[String](4,"cc")
demo.show(1,"cc")
val demo2=new Demo001[Int,Int]
demo2.show(10,20)
}
}