sometimes I start my java program with public class program_name{ and sometimes I start with class program_name{ my program runs with public class & class, what is the difference or role of public at start?
The difference is whether or not other classes will be able to access the contents of the class you've made. Remember, when you write a java program, you don't have to put all the classes in one file, they can all have their own file, as long as they are in the same directory. I think what you're really getting onto is a concept in java & other languages called "access modifiers." This should provide you with the right information: http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
If you have a class named "pie" for example you will need to do public class pie. Under that yu could have class lasagna, etc.
public, private, static, global, dynamic, OOP all good keywords
Join our real-time social learning platform and learn together with your friends!