To understand the difference between these two different files you have to install the latest released version of java and JDK (Java Development Kit).
When you create your java program using
nvim Example.java
You'll need a compiler for your terminal to read it. In a nutshell a compiler is like the reason people learn languages like ASL. It's like training a Dragon to be friendly with your village and understand patterns. It'll translates .java file to another programming language. In this case will be a filename extension that contains executable Java bytecode, a called .class file.
As always I'd recommend you to install it in your preferable terminal.
You have to get used with CLI and avoid other simplistic environments. You'll become a power user doing that way.
Type javac Example.java to compile your java program.
And then type java Example to run it.
[!IMPORTANT]
Your public class needs to match program's name i.e.
public class Example
