title: Unexpected Token error in Login Function
body: <p>I have written a Login function in Android Studio. There is an error in "else" UnExpected Token.</p>
  
  <pre><code>else {
      displaymessage.setText("Login is unsuccessful");
  }
  </code></pre>
  
  <p>The code as follows:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      private EditText etName;
      private EditText etPassword;
      private Button Login;
      private TextView displaymessage;    
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          etName=(EditText)findViewById(R.id.etName);
          etPassword= (EditText) findViewById(R.id.etPassword);
          Login= (Button)findViewById(R.id.BtnLogin);
          displaymessage=(TextView) findViewById(R.id.displaymessage);
  
          Login.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String Name = String.valueOf(etName.getText());
                  String password = String.valueOf(etPassword.getText());
  
                  if (Name.equals("Ammad") &amp;&amp; password.equals("Ammad"))
                      displaymessage.setText("Login is successfull");
              }
              else
              {
                  displaymessage.setText("Login is unsuccessful");
              }        
          });    
  }
  </code></pre>