//without CLASS
object Demo {
def main(args: Array[String]) {
var str1 = " Welcome to Scala Programming"
var str2 = " Welcome to Scala Programming"
var str3 = " welcome to scala programming"
println(str1==str2)
println(str1==str3)
println(str2==str3)
}
}
(or)
//with CLASS
class StringExample{
var str1 = " Welcome to Scala Programming"
var str2 = " Welcome to Scala Programming"
var str3 = " welcome to scala programming"
def show(){
println(str1==str2)
println(str1==str3)
println(str2==str3)
}
}
object Demo {
def main(args: Array[String])
{
var s= new StringExample()
s.show()
}
}
Output:
true
false
false