How to create list in Kotlin? : <p>I tried these in Kotlin REPL</p>

<pre><code>var listA = listOf(null ,null)
var listB = [null, null]
</code></pre>

<p>The first line works fine as expected. On displaying listA I get:</p>

<pre><code>[null, null]
</code></pre>

<p>The second line throws the following error:</p>

<pre><code>error: cannot use 'Nothing?' as reified type parameter
var listB = [null,null]
            ^
error: unsupported [Collection literals outside of annotations]
var listB = [null,null]
            ^
error: unsupported [Array&lt;Nothing&gt; in return type is illegal]
var listB = [null,null]
            ^
</code></pre>

<p>When I try the same with non null types,
i.e.</p>

<pre><code>var listC = [1,2]
</code></pre>

<p>I get this error:</p>

<pre><code>error: unsupported [Collection literals outside of annotations]
var listC = [1,2]
            ^
</code></pre>

<p>I'm new to Kotlin. Can someone please explain what is going on here?</p>
