CrazySynthax
CrazySynthax

Reputation: 15008

Scala REPL: How to load specific package/class/object?

Let's say I have the following file:

package PackName

class Class1 { 
   def func11():
   ....
   def func12():
   ...
}

class Class2 { 
  def func21():
  ...
  def func22():
  ...
}

If I want to invoke func11 from Class 1 from REPL, I have to run REPL and call:

PackName.Class1.func11().

Do I have an option to load to REPL the class PackName.Class1 so I won't have to type "PackName.Class1" whenever I invoke a function of this class?

Upvotes: 0

Views: 701

Answers (1)

Samar
Samar

Reputation: 2101

import PackName._  //import all members of the package
import PackName.Class1  // import a specific member
import PackName.{Class1, Class2} //import multiple members

Upvotes: 1

Related Questions