title: What does [B >: A] do in Scala?
body: <p>What does <code>[B &gt;: A]</code> mean in Scala?  And what are the effects?</p>
  
  <p>Example reference: <a href="http://www.scala-lang.org/node/129" rel="noreferrer">http://www.scala-lang.org/node/129</a></p>
  
  <pre><code>class Stack[+A] {
      def push[B &gt;: A](elem: B): Stack[B] = new Stack[B] {
          override def top: B = elem
          override def pop: Stack[B] = Stack.this
          override def toString() = elem.toString() + " " + Stack.this.toString()
      }
      def top: A = error("no element on stack")
      def pop: Stack[A] = error("no element on stack")
      override def toString() = ""
  }
  
  object VariancesTest extends Application {
      var s: Stack[Any] = new Stack().push("hello");
      s = s.push(new Object())
      s = s.push(7)
      println(s)
  }
  </code></pre>