The first day of the Java Learning Diary
Java Learning Preparation Work
First Environment configuration:
One is the JDK installation,
Another compilation tool, Eclipse,
Installation Download Tutorials Online Many have looked for one to do just that;
When the above steps are complete, we can open eclipse to write our first program.
Of course, writing our familiar HelloWorld.
Create a Java Perfect It's almost as if you're getting used to engineering management. We'll build a Java project.
Then click on the project in the SRC right-click New A class, do not ask what this is what this is, first run the program, slowly understand
We write our program in {}, which is like HelloWorld this class yard, in which is his
We need a main function, which we call the main function format is also fixed
public static void Main (String args[]) {}
Let's write down the console output Hello,world again this main his {}!
Code: System. Out.print ("hello,world! ");
We can see hello,world! at the bottom of the console by running it. the words;
By this time our first program is finished, there are many do not know the place is not OK more slowly
And then we understand that in Java, the data type is divided into: basic type byte int short long float double Char Boolean
Reference data Type String class
Let's write a second program.
Declaring a variable of type string, making conditional judgments
This piece of code involves
1. Conditional Judgment If statement if usage:
if (condition) {logical processing} The condition is true to execute the code in {}, if only one line of code can be without {};
The IF (condition) {}else{} condition is true to execute the first {} code, the condition is false to execute the code inside the {} behind the else;
if (condition 1) {}else if (condition 2) {}....else if (condition N) {} and the second if usage is almost only a judgment of more conditions
2. String type string strings in Java are classes, reference types, there are many intrinsic functions, others are encapsulated,
For example, this code in the conditional statement to use the equal, is the meaning of the comparison, PName represents the string and equal behind the "" in the
The strings are judged equal. Equal return ture, both true, unequal is false,
3. String concatenation with + this symbol in this code says PName code and MSG in the code together.
The first day of the Java Learning Diary