Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

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?

OpenStudy (anonymous):

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

OpenStudy (konradzuse):

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.

OpenStudy (anonymous):

public, private, static, global, dynamic, OOP all good keywords

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!