জয়েন লগইন

জাভা map

🌈জাভা map কি?

📋জাভা map হলো কী ও ভ্যালু জোড়া আকারে রেন্ডার করার পদ্ধতি।

⚒️জাভা map কী ও ভ্যালু জোড়া আকারে রেন্ডার করতে ব্যবহৃত হয়।

জাভা map কী ও ভ্যালু জোড়া আকারে রেন্ডার করার উদাহরণ।

java
import java.util.Map;

public class Main {
  public static void main(String[] args) {
    Map<String, String> info = Map.of(
      "নাম", "মোঃ আরিফ",
      "দেশ", "বাংলাদেশ"
    );

    System.out.print("<table border='1'>");

    for (Map.Entry<String, String> entry : info.entrySet()) {
      System.out.print("<tr>");
      System.out.print("<th>" + entry.getKey() + "</th>");
      System.out.print("<td>" + entry.getValue() + "</td>");
      System.out.print("</tr>");
    }

    System.out.print("</table>");
  }
}