The first thing to start programing in any language is to print the famous Hello World. In this blog post I’m going to show you how I did my Hello World and what I used to make it possible.
First of all, objects and class-
Objects: Objects have states and behaviors, for example a car has stats like color, form, name and behaviors would be how fast it goes or how many gasoline it use.
Software objects also have a state and behavior. A software object’s state is stored in fields and behavior is shown via methods.
In software development, methods operate on the internal state of any object and the objects communicate by methods.
- Method: “A method is a collection of statements that are grouped together to perform an operation.“http://www.tutorialspoint.com/java/java_methods.htm
- Statements: ” A statement forms a complete unit of execution.” https://docs.oracle.com/javase/tutorial/java/nutsandbolts/expressions.html
So in resume a method has a bunch of statements inside, and methods are what gives objects its particularities.
Class: A class is like a box that has inside has methods and those methods are affecting the objects inside the class
- Public class: When a method is public it means it can be accessed by other objects of other classes.
- Privet class: When a method is private it means it can only be accessed by objects OF THE SAME CLASS, so You can create a bunch of methods and keep them private, avoiding data corruption or in general preserving your objects encapsulated. (http://stackoverflow.com/questions/2647289/what-does-it-mean-for-a-method-to-be-public-private-other-in-java)
Now the definition of each word used to make thos program.
“public” means that main() can be called from anywhere.
“static” Tell that theres no need for an input to run the program.
“void” means that main() returns no value
“main” The first thing that runs in all the program.
“String” means an array of String.
“args” is the name of the String (within the body of main()). “args” is not special; you could name it anything else and the program would work the same. https://www.quora.com/What-does-each-term-in-public-static-void-main-String-args-mean
Now that you have all this information you can make your program.
This will be the result:
All the links in this blog post sends you to the respective information and here’s a video explaining each step.