Learning Java's first lesson

xiaoxiao2021-03-06  71

first lesson

1. Learn about the running environment of java.2.java, JDK configuration .3 .6. Note .4. Keyword 5. Basic data type .6. String 7. Identifier. 8. Variable assignment and initialization .9. Operator .10.java.lang package .11. Control structure .12. Array.

I. ^ _ ^. Probably looked at the so-called Java feature. Anyway, it is very nice.

II. Java is running in the JVM environment. It is also the legendary Java virtual machine. JVM can be seen as a micro operating system to form an abstraction layer. Link the underlying hardware platform, the operating system and the compiled code. JDK-Developing a Java program toolkit. Includes: class library, compiler, debugger, Java running environment JRE. SET PATH = JDK / BIN; set classpath = jdk / lib / Tools.jar;.; here, add "." The specific is not clear, it seems to call the class under the current folder.

Iii. Note in three: 1. Untrue annotation. // EG. This is a comment 2. Multi-line comments. / * Note content ....................................................... * / 3. Document comments. / *** This is comment. *Ha ha*/

IV. This guy also has keywords. And C is similar.

V. Java has eight data types, including four integer types, two floating point types, character types, and a Boolean type. 1.byte short int long2.float double3.char4.boolean

Vi. Java provides a String class that processes strings as a String type. EG string strname = "this is my first name"; string strlist = new string ("o, my god."); 1. String pool // is not very well understood. 2.String class method. Chatat () intercept characters. IndexOf () returns an index that appears for a particular character or sub-string in the string. TouPpercase () lowercase. TOLOWERCASE () uppercase

VII. Identifier 1. Opening in the letter under the letter, the rest is letters, numbers, $, and underline 2. Cannot contain spaces

VIII. Variable assignment and initialization variable has three features: name, initial value, scope declaration syntax: data type identifier [= value] [, identifier [= value] ...]

IX. Operator

1. The calculative calculative calculator cannot be used on the Boolean type, but can be used on the char type, because in Java, char is a subset of int types

2. Relationship operator returns Boolean value

3. Logical operator

A

B

A & B

A | B

A ^ b

! A

T

Fly

Fly

T

T

Fly

Fly

T

Fly

T

T

T

T

T

T

T

Fly

Fly

Fly

Fly

Fly

Fly

Fly

T

&& (short circuit and) || (short circuit or)

4. Bit operator

~

&

|

^

>>

>>>

<<

& =

| =

^ =

>> =

>>> =

<< =

5. Assignment operation

6. Trinary operation conditions? Expression 1: Expression 2

7. When the left side of the InstanceOf operator is the instance of the right side, returns true, can determine if the object belongs to a particular class

X. java.lang package java.lang is automatically imported into all classes. The Object class is the most important time.

Xi. Control Structure

¨ Selection

IF-ELSE

2. Swith

¨ cycle

While

2. Do-while

¨ Jump

Break

2. Continue

Xii. Array declaration format: Type var-name []; general form: var-name = new type [size]; the subscript starts from 0. In-line initialization: int a [] = {12, 33, 23, 4}

转载请注明原文地址:https://www.9cbs.com/read-120523.html

New Post(0)