Problem with map

0

I have a problem, I want to make a user login program with the Map interfaces, but in my class "password" does not let me use the put method to start the programimport java.util. *;

public class Main{


  public static void main(String[] args)
    {




    System.out.println("     COMISION LALO S.A DE C.V");

    System.out.println("opcion 1: crear usuario. \nopcion 2: cargar usuario");






    }}

 class Contraseña {
    Map <String,String>a=new HashMap <String,String>();


    private void estableceUsuarioContraseña( String usuario,String contraseña){


    }


 }'
    
asked by Eduardo Farias 21.05.2017 в 06:36
source

1 answer

1

Try the following Code Snippet:

//Declaramos e instanciamos un Map con clave String y value String
Map<String,String> mapa = new HashMap<>();


private void estableceUsuarioContraseña( String usuario,String contraseña)
{
    mapa.put(usuario, contraseña);
}

I hope it serves you Greetings.

    
answered by 21.05.2017 / 17:39
source