The 0 is an extra edition, or something that you will understand somehow, but it is very important. The main story is from Part 1. I also write a description of the series. https://qiita.com/Shodai-Kurasaki/items/99cf6b0ec1a8e80640b1
Sample1.java
class Sample1
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
As you can see, there is a {} in the code. If you move a lot of code, you will find out where it is, but what you should remember is ** Make sure the number of {and} is the same ** That is (exception: {does not count as a character). I think I'll soon write a program that uses this set a lot, but if I don't have enough at that time, it won't work anymore. ** To prevent it, each set of {} is stepped. It is normal to press the tab key once. ** **
System.out.println ("Hello World!") **; ** โ This ** Basically, always add it to the end of one sentence. ** Exceptions are followed by {}.
class Sample1
{โ like this{}Except for the one that comes behind;I will put on.
It won't work without it. By the way, it doesn't mean that it doesn't work unless you put a line break after this.
System.out.println("Hello World!"); System.out.println("Hello World! 2");
There is no problem. However, basically it will be difficult to see, so please start a new line.
Sample1.java
class Sample1 โ This is the class name
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
** The class name should be the same as the file name **. It can be different, but don't think about it at first. By the way, the extension of the file should be saved as .java.
In the program, there will be places where you want to keep notes. For example, "This sentence is for displaying Hello World!". In such a case, write ** // ** and write a memo after that. // After that, it will be completely ignored when the program is executed, so you can write it as you like. However, // only notes the contents after // on that line. If you want to make a note over multiple lines, use ** / * * / ** to insert the note.
Sample1.java
class Sample1
{
public static void main(String[] args)
{
System.out.println("Hello World!"); //Here is a memo
/*Here also~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Note*/
}
}
If you have any points to be corrected, please point them out.
Recommended Posts