জয়েন লগইন

জাভা nested

🌈জাভা nested কি?

📋জাভা nested হলো নেস্টেড রেন্ডার করার পদ্ধতি।

⚒️জাভা nested নেস্টেড রেন্ডার করতে ব্যবহৃত হয়।

জাভা nested নেস্টেড রেন্ডার করার উদাহরণ।

java
import java.util.Map;

public class Main {
  public static void main(String[] args) {
    Map<String, Object> user = Map.of(
      "নাম", "মোঃ আরিফ",
      "তথ্য", Map.of(
        "স্বপ্ন", "সফটওয়্যার ইঞ্জিনিয়ার",
        "দেশ", "বাংলাদেশ"
      )
    );

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

    System.out.print("<tr>");
    System.out.print("<th>নাম</th>");
    System.out.print(
      "<td>" + user.get("নাম") + "</td>"
    );
    System.out.print("</tr>");

    System.out.print("<tr>");
    System.out.print("<th>তথ্য</th>");
    System.out.print("<td>");

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

    System.out.print("<tr>");
    System.out.print("<th>স্বপ্ন</th>");
    System.out.print(
      "<td>" +
      ((Map<?, ?>) user.get("তথ্য")).get("স্বপ্ন") +
      "</td>"
    );
    System.out.print("</tr>");

    System.out.print("<tr>");
    System.out.print("<th>দেশ</th>");
    System.out.print(
      "<td>" +
      ((Map<?, ?>) user.get("তথ্য")).get("দেশ") +
      "</td>"
    );
    System.out.print("</tr>");

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

    System.out.print("</td>");
    System.out.print("</tr>");

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