Originally posted by Preetha Arun:
Here i am getting the error, class inheritex is public and should be declared in a file name inheritex.java
If you have a Class definition whose access specifier is 'public' , then you must save the file with public class name !
Like In your example , your file name is "inheritex.java" !
For further information , follow this
link !