java learning (day1)

Before learning java did not take lectures, it will not proficient, so ready to re-start to learn some of the details, the Daily Record new knowledge.

a+b

java of a + b is very interesting, when you are output "" + a + b, assume that a = 2, b = 3. Then the above output is 23, achieved a string concatenation, which with the time I had to learn the same

However, not the same parentheses after "" + (a + b) or a + b + "". The answer is 5, execution of a + b.

java get keyboard

When the original study, is directly from the object-oriented start, also did not say how to get keyboard input.

Scanner comes with a java class, first create a new class with the Scanner. Apply a java joke, no object how to do? a new ah.

For example Scanner input = new Scanner (System.in); If, after the input is integer type, input.nextInt (); thus, if it is another type, there are other next. As shown below

 cycle

Here is the main point of a little old knowledge forget, remember here, the difference between while and do while in.

do while to do is go to judgment while. That is when the conditions are met while inside, we will do again. But not only while in the case. When the condition is not met while direct end.

Eight basic data types

First mark about, short, long, Boolean, char, int, byte, double, float.

c and he almost, remove and byte boolean

 

These are looked after process-oriented, object-oriented start looking tomorrow

Guess you like

Origin www.cnblogs.com/afei123/p/11329999.html