Android Studio is available in the Endless app store, so the JDK is available inside this Flatpak - it’s actually also included within the Flatpak SDK that Endless OS apps are built against - so you can get in to the flatpak and use javac:
ramcq@upsilon:~$ flatpak install --runtime eos-runtimes com.endlessm.Sdk//eos3.1
Installing: com.endlessm.Sdk/x86_64/eos3.1 from eos-runtimes
2386 metadata, 26826 content objects fetched; 267608 KiB transferred in 700 seconds
ramcq@upsilon:~$ flatpak run --filesystem=host --command=javac com.endlessm.Sdk/x86_64/eos3.1 -version
javac 1.8.0_102