Android - The local variable tst may not have been initialized
<p>My work code is</p>

<pre><code>@Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) 
    {
        Toast tst;

        if (item.getItemId() == R.id.menuVada) {
            tst = Toast.makeText(Main.this, " Vada ", 2000);

        } else {
            tst = Toast.makeText(Main.this, "Menu Title: " + item.getTitle()
                    + " Menu ID: " + item.getItemId(), 2000);
        }
        tst.setGravity(Gravity.CENTER, 0, 0);
        tst.show();

        return true;

    }
</code></pre>

<p>but this code not work</p>

<pre><code>@Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) 
    {
        Toast tst;

        if (item.getItemId() == R.id.menuVada) {
            //tst = Toast.makeText(Main.this, " Vada ", 2000);

        } else {
            tst = Toast.makeText(Main.this, "Menu Title: " + item.getTitle()
                    + " Menu ID: " + item.getItemId(), 2000);
        }
        tst.setGravity(Gravity.CENTER, 0, 0);
        tst.show();

        return true;

    }
</code></pre>

<p>why not work my code ?</p>

<p>Please help.</p>

<p>Best Regards</p>
