I joined an IT company from this spring. It was a start that I myself was touching C language at university. Meanwhile, it was difficult to understand what I thought after receiving programming training. In the end, I heard that the training was substantial, but I ended up covering everything by self-study. I started writing to new employees (new students?) Who are completely new to programming, hoping to be able to tell them that programming is like this.
You need an environment to do programming. java is kind of annoying, and sometimes it doesn't work without jdk. There are various development environments and execution environments for programming itself, but if you want to start java for the time being, I think Dokojava is fine. You can find it by searching ** Dokojava **. If you are tired of typing passwords one by one, download eclipse. You can download it by searching for "pleiades" and (probably) going to the top site.
This time, I will write assuming Dokojava.
Let's actually write it. When you log in to dokojava,
Main.java
public class Main{
public static void main(String[] args){
System.out.println("Hello World");
}
}
I think it says.
Don't worry about public ~~ for the time being, and don't play with it **.
System.out.println("");
Is called standard output, and it copies the characters enclosed in "" on the screen.
Please keep in mind that this is the grammar you will be using. Now, you can look at the above, so let's add another line of your choice.
Example
public class Main{
public static void main(String[] args){
System.out.println("Hello World");
System.out.println("Hello Java");
}
}
Once you have added it, run it.
Dokojava people are easy and I think there is a word "compile" at the top of the screen, so click on it. You will be asked for a password (?), So enter it. ** (Please note that only half-width characters are recognized !!) ** It is OK if the text "No error" is displayed on the right side. If you have a message that you are not sure about, please check;, () and {} while looking at the above example. At first, there is no problem with a full copy.
Well, this is the end of compilation (like checking for errors). It's finally done. This is also easy for Dokojava people, and the word "Run" is on the right side of the compilation, so click it. You will also be asked for a password (?), So enter it. ** If you get "Run with details", click a little further to the left. ** **
To the bottom,
Hello World Hello Java
Is OK. ** Make sure that the "Hello Java" part contains the characters you typed. ** **
To run the resulting program, ** "compile" and "execute" **. Let's remember.
The last is a variable. It's like x, y in mathematics, and you can enter values. That said, it's hard to understand, so rewrite the Dokojava code as follows.
Main.java
Public class Main{
Public static void main(String[] args){
String str = "Good Morning";
System.out.println( str );
}
}
After rewriting, let's "compile" and "execute". (If you don't understand, please proceed while looking at the above contents)
As a result of executing, to the bottom
Good Morning
If it says, it's OK.
Try replacing Good Morning yourself and seeing the output.
Well, how was it going so far? It's still going on, but for the time being, it's a break. I'm accepting input with the keyboard from now on, but there is a problem. ** ** To accept keyboard input with Dokojava, you must either ** register as a member of Dokojava or install a development tool called JDK .... ** If you've been following along so far, please ** install the JDK **. If you click on the gear in the upper right corner of Dokojava, there is an item called ** JDK Installation Guide **. If you follow the instructions there, you can install it. Of course, you can use Dokojava as it is.
If you still don't understand, please try it repeatedly. It's good to move on, but let's review this content once more.
Recommended Posts