+ 4
How do to get user input data store it in a hashMap or LinkeList den, display that data on/in JTable...
3 odpowiedzi
+ 2
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class sortloc {
  public static void main(String[] args) {
     System.out.println("Manoprabu.R");
       ArrayList<String> name = new ArrayList<String>();
       ArrayList<String> location = new ArrayList<String>();
    HashMap<String,String> myMap = new HashMap<>();
        
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("Please enter your Name: ");
            name.add(sc.next());
            System.out.println("Please enter your Location: ");
            location.add(sc.next());
            myMap.put(name.get(0),location.get(0));
            name.clear();
            location.clear();
            System.out.println(myMap);
        }
  }
}
0
if this is a GUI application in Java, design it with JavaFXs form designer, add a text box and a button. When the button is pressed take the contents of the textbox and add it to the hashmap...
0
Manoprabu.R , thnks buh am quite aware of that one....i want to get user inputs from the textFields(gui)  den semaltineously store dem in hashMap or so.....den when i press the display button the data that was stored in a hash map or linkedList is displayed in a Jtable i dont know if it is possinle though.



