Unable to reproduce:
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :paste
// Entering paste mode (ctrl-D to finish)
import scala.collection.mutable.ListBuffer
var fruits = new ListBuffer[MyClass]()
class MyClass(a:String, b:String, c:String)
var d1=new MyClass("data1","data2","data3")
fruits += d1
// Exiting paste mode, now interpreting.
import scala.collection.mutable.ListBuffer
fruits: scala.collection.mutable.ListBuffer[MyClass] = ListBuffer(MyClass@291c57ba)
defined class MyClass
d1: MyClass = MyClass@291c57ba
res0: scala.collection.mutable.ListBuffer[MyClass] = ListBuffer(MyClass@291c57ba)
EDIT:
You might have re-defined MyClass and it led to "type mismatch" error. Maybe something like this:
scala> :paste
// Entering paste mode (ctrl-D to finish)
import scala.collection.mutable.ListBuffer
class MyClass(a:String, b:String, c:String)
var fruits = new ListBuffer[MyClass]()
// Exiting paste mode, now interpreting.
import scala.collection.mutable.ListBuffer
defined class MyClass
fruits: scala.collection.mutable.ListBuffer[MyClass] = ListBuffer()
scala> :paste
// Entering paste mode (ctrl-D to finish)
class MyClass(a:String, b:String, c:String)
var d1=new MyClass("data1","data2","data3")
fruits += d1
// Exiting paste mode, now interpreting.
<console>:14: error: type mismatch;
found : MyClass(in object $iw)(in object $iw)(in object $iw)(in object $iw)
required: MyClass(in object $iw)(in object $iw)(in object $iw)(in object $iw)
fruits += d1
^