Explain Java Program With Theory & DetailsYou had seen on my previous post a "Simple Java Program Writing" how to write java program.
In that program you see lots of keywords, what does that meanings, why we are using.Now i am gonna explain you every step meaning
1. You know we need to create class for writing class, so we are giving the name of the class as SimpleExperiment and make it as a public so we can use anywhere.Ex: public class SimpleExperiment2. Then we declare the method as a staticJava allows us to define a class within another class. Such a class is called a nested class. The class which enclosed nested class is known as Outer class. In java, we can’t make Top level class static. Only nested classes can be static. That's why onlu main class declare as a static.For Ex: public static void main(String args[]) Then we need to pass Argument so for that we take args[] as a argument and in main method we pass.For Ex: Public static void main(String[] args).3. Then in between { & } we write down the code for printing the messasge.For Ex: {
// TODO code application logic here
System.out.println("Java Programming Tutorials");
}Then Close class closing braces and now your program is ready. Learn How To Run Java Program In Next Post...Thanks
Why java declare as a static, why class declare as a public, How to print message in java
Labels: Java Program Explanation