Source code for PasswordExample.java:

public class PasswordExample
{
	public static void main(String args[])
	{
		// PasswordExample
		String password = new String("Wrong password");
		if (password.equals("peekaboo"))
			System.out.println("success");
		else
			System.out.println("Access denied");
	}
}

Output from PasswordExample.java:

Access denied

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the PasswordExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR