The first day of the Java Learning Diary

Source: Internet
Author: User
Tags float double

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.