/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pkg0407; import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * * @author Admin */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner le = new Scanner(System.in); Map mapa = new HashMap(); mapa.put("piotr", "lala"); System.out.println("podaj login"); String getlogin = le.nextLine(); while (!mapa.containsKey(getlogin)) { if (mapa.containsKey(getlogin)) { String haslo = mapa.get(getlogin); System.out.println("Podaj haslo"); String gethaslo = le.nextLine(); le.nextLine(); if (gethaslo.equals(mapa.get(getlogin))) { break; } else { System.out.println("zle haslo"); } } else { System.out.println("Zly login"); getlogin = le.nextLine(); } } } }