I'm in beginners Java and I have a question... I've written about 16 programs in my class so far and in all my programs this is what we would do:
Create a Folder (let's call the folder Project1)
Make a .java file (project1.java)
then we would go to our practice chapter files right click and copy any .class file
Rename it (i.e project1.class) and that would work fine.
So we've never seen what's in a .class file what's suppose to be in a .class file or anything.

Now here's where i'm a little confused. I'm now suppose to make GUI and Object Oriented Design program to calculate the price of some things but when I go to my chapter practice files and right click and copy a class file of a program with the same type of logic as to what i'm trying to acheive I get an error:

----Hit any key to start.
Exception in thread "main" java.lang.UnsupportedClassVersionError: Project2 : Un
supported major.minor version 8241.8224
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

----Hit any key to continue.


This is making me think I have to write a class file?? But I've never done that so I'm not too sure...And if I do, what goes in the .class file? Can someone please explain?

Thanks so much

Have you ever written a .java file and compile it by doing:

javac file.java

?

So we've never seen what's in a .class file what's suppose to be in a .class file or anything.
....

This is making me think I have to write a class file?? But I've never done that so I'm not too sure...And if I do, what goes in the .class file? Can someone please explain?

Thanks so much

writing a program is easy, getting it compiled and running, now that's the fun part. to make something (you should already have guessed by now) a bit more clear:
you should be CREATING class files, not WRITE them. a.class file is the compiled version of your .java files

write a .java file, compile it, et voila, your .class file is good to go

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.