I've only played a lot of Bedrock edition, but I just came up with Minecraft Java Edition and I have no clue here.
I made a bit of research and found out that these ones are around the best:
- Guardian farms (Highly efficient, but highly resources friendly)
- Enderman farms (Efficient and resources friendly)
- Witch farms (Didn't found a result about its efficiency)
Also, I saw a video where furnaces can store XP since earlier versions of Java and someone build a cactus based farm where you can get to level 30 by just taking out one cactus after letting the farm working by almost an hour.
What are the best strategies to obtain XP for enchanting with higher levels in Java Edition?