java nightmare

I have serious problem with this small java program that could not run on opensuse 13.1; therefore, I’m looking for help resolve it. I downloaded this: linux x64 135.6mb jdk-8u20-linux-x64.rpm on opensuse 13.1. I wrote this little program from a tutorial book:

/*
This is just to try this sample java program
Call this program Example.java
*/

call Example {
public static void main(String args]) {
double gallons; // holds the number of gallons
double liters; // holds conversion to liters

gallons = 10; // start with 10 gallons
liters = gallons * 3.7854; // convert to liters
System.out.println(gallons + " gallons is " + liters + " liters. ");
}
}

  • I saved the program as Example.java
  • I used chmod for permission to execute the program
  • Compile the program: javac Example.java
  • Run the program: java Example

The result was series of errors:
Exception in thread “main” java.lang.UnsupportedClassVersionError: Example:Unsupported major.minor version 52.0
at java.lang.Classloader.defineClass1(Native Method)

     and more 14 lines of errors that's needless to write them here.

Please could you check this program and point out where I did something wrong. Thanks

Did you install Java??

You should have “class Example {” and not “call Example {”

Thanks for the correction; this was typo error, instead of class Example, I wrote call Example. The problem has not been resolved. Even with class Example, the program still produces errors. Please I still need help to resolve this problem. Thanks.

Well what are the errors?

Was the code copied from a Windows source?? Remember that Windows end a line the a CR+Linefeed this can confuse things that expect just a line feed