Answers for "does java have structs"

2

java struct

Java 14 has added support for Records, which are structured data types that are very easy to build.

You can declare a Java record like this:

public record AuditInfo(
    LocalDateTime createdOn,
    String createdBy,
    LocalDateTime updatedOn,
    String updatedBy
) {}
 
public record PostInfo(
    Long id,
    String title,
    AuditInfo auditInfo
) {}
Posted by: Guest on September-20-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language