This article assumes that the reader does not understand anything, or has to toss some language, such as C, but the beginner.
Classic case, HelloWorld start, learn a language in the understanding, I try to explain why to write, it is very likely that the designer is not designed according to this idea,
Java is an object-oriented language, in the object-oriented world, they classify a lot of things, for short, all things are objects. Okay, a keyword came out. Class (Class), which is plainly a collection, an element belonging to this class, (-set belongs to this set.)
This class can be familiar to the outside world, okay, communist victory, public shutdown word come, take hello for example, nature this class called Hello, the first line of public class Hello//Well this is the grammar of the language, that is, the order of words Way, that design language people so designed/We define a public class Hello, can print output HelloWorld,
Well, the printout, in the C world we write print ("Hello"); Yes, it does. The meaning of the printout hello, well, it's English, yes.
We have to talk about a paragraph before we have to open a head, end it, the language designer to the beginning and end of the design together, said the key in the inside main, what effect does main have, no effect is blank void, return to a vernacular, this method also has to be public, and this print and C Is it the same inside? Java programs run on virtual machines, right? That's what we have to tell our mainframe to do.
System, you output a string to call the system method systems. IO, Output System.out.println ("string")
Declares the return of this method, and the input, which is usually called a parameter, argument
public void Main (String [] args) {
System.out.println ("Hello")
}
Well, the whole program is like this,
Public class Hello {public static void Main (String [] args) { System.out.println ("Hello");} }
Tail: Or I Python fun, simple not wordy:
Print ("Hello")
Stupid way to learn Java