title: How to define a method in Scala that returns a Java object?
body: <p>I want to define a private method in scala singleton class that looks like;</p>
  
  <pre><code>private def  createDomNode(tag: String, attrs: Map[String , String]): DomNode  {
  
  }
  </code></pre>
  
  <p>DomNode is Java type, not scala type. attrs is scala Map with both key and value being of type String.</p>
  
  <p>But above gives error. What is the correct format?</p>
  
  <p>Thanks Easy Angel for the answer. There is still some confusion. According to Programming in Scala book written by the inventor of the language, the below is a function:</p>
  
  <pre><code>def max(x: Int, y: Int): Int = {
    if (x &gt; y) x
    else y
  }
  </code></pre>
  
  <p>But your answer says it is method and not function. Can you kindly explain?</p>
  
  <p>What is REPL?</p>