Java is memory safe. https://www.nsa.gov/Press-Room/Press-Releases-Statements/Press-Release-View/Article/3608324/us-and-international-partners-issue-recommendations-to-secure-software-products/
Recommended memory safe programming languages mentioned in the CSI include C#, Go, Java, Python, Rust, and Swift.
For details about these recommendations see https://media.defense.gov/2023/Dec/06/2003352724/-1/-1/0/THE-CASE-FOR-MEMORY-SAFE-ROADMAPS-TLP-CLEAR.PDF
Also, I should note that Kotlin (a Java alternative that is used by many/most Android devs) is also memory-safe. Here is the cloc decomposition for K9-Mail / Thunderbird-android from GitHub - thunderbird/thunderbird-android: Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail) . You’ll note that in terms of actual code (Kotlin and Java), the project is written in memory safe languages.
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Kotlin 1472 18752 3038 102035
XML 830 1639 3913 67019
Java 346 9939 6903 44367
SVG 72 27 46 6541
Gradle 66 331 18 1609
YAML 23 187 77 1541
JSON 23 0 0 948
Markdown 24 264 0 674
TOML 1 4 13 256
Bourne Shell 7 66 136 204
DOS Batch 1 21 2 69
ProGuard 2 19 29 35
-------------------------------------------------------------------------------
SUM: 2867 31249 14175 225298
-------------------------------------------------------------------------------