Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Vectors to store values

Status
Not open for further replies.

hbutt

Programmer
Apr 15, 2003
35
GB
hi there,
jus wanted to know how create a vector to store a username and password, which i can call up each time my program is executed.
thanx.
hbutt
 
Vector login = new Vector ();
login.add (username);
login.add (password);

//...
username = v.get (0);
password = v.get (1);
----
if this is your question.

If you need more than one password, consider of modelling this another way:
public class Login
{
private String username;
private String password;

public Login (String u, String p)
{
username = u;
password = p;
}
// getUsername meth. etc. ...
}

Vector logins = new Vector ();
logins.add (new Login ("Frank", "Zappa");

I guess a Map would be more helpful in this case.
I guess more: I misunderstood the question.
 
hi there this what i actually need to do

A constructor which takes two parameters; the users name (a string) and the users cipher key (a string). A Vigenere cipher matrix is initialised if the key is valid (same rules as the last class) and the users name is valid. The users name is invalid if the string contains a space. Everything else is valid (upper and lower case letters, symbols, ... ).
An accessor called "getUser" to return the users name.
A main method that tests the functionality of "User"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top