The error is mainly due to wrong class declared. To solve there are two methods
check for class name and file name
if your file name is basics.java then class name must be basics and written like this public class basics{
and for best compilation there must be not space between basics and { this brakcet
check for correct compilation in terminal
it must be javac basics.java (maybe you only used javac basics)
and after the compilation task to run the file use java basics.java (maybe you forgot to type .java)