Q:

BlueJ (How to give a String value in if else)

What is wrong in this program?
I wanted to create a program that will open only when password is put.
It is not accepting the String value as password. So can any one modify it??
import java.io.*;

class aa

{

    public static void main(String input)throws IOException
    {
        String a;
        if(a.equals("A"))
        {
            InputStreamReader read = new InputStreamReader(System.in);
            BufferedReader in = new BufferedReader(read);
            double x;
            double y;
            double z;
            System.out.println("Please type the two Numbers");
            x=Double.parseDouble(in.readLine());
            y=Double.parseDouble(in.readLine());
            z=x*y;
            System.out.println("Product="+z);
        }

        else
        {
            System.out.println("Wrong Password");
        }
    }
}

A:

String a;
if(a.equals("A"))
{
  ...
  ...
}

You havent assigned any values to your variable a. Hence, it never enters the if loop . Try this:
String a;
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
a = in.ReadLine();    
if(a.equals("A"))        
{
      ...
      ...
}            

