1. Concept
(1). Net/DOTNET: generally refers to the. netframework framework, a platform and a technology.
(2) C # (sharp):Programming LanguageTo develop applications based on the. NET platform.
(3) Java is a programming language.
- Integrated Development Environment (IDE)
- Note in C #:ProgramAnnotations:
First, the single line comment starts with // and ends at the end of the line.
Type 2: multi-line comments/* Start, */end, all comments
Third, document comments are used to annotate classes or methods. Enter // before the class or method to display all the comments.
- . Net is a multi-language platform. Development. Net can be performed in dozens of languages.
Java is a single-language platform with multiple languages.
- Microsoft intermediate language (msil)
- Variable
(1) The computer uses memory to store data.
(2) variables represent a piece of memory space. We can store/retrieve data from memory using the variable name. If there is a variable, we do not need to remember the complex memory address.
(3) syntax for applying for a memory space from memory: data type variable name;
Example: int I; I = 100; double PI; Pi = 3.14;
Note: In the C # development environment, write a number with a decimal point. This number is of the double type. Add m/m after a decimal point, it tells the compiler that the number is of the decimal type.
Three methods for variable declaration:
1) declare it first and assign a value to it. Int A; A = 3;
2) assign values directly when defining variables. Int A = 3;
3) declare multiple variables of the same type at a time. Separate multiple variables with commas (,) and end.
String zsname, lsname, wwname; int zsage = 18, lsage = 20; wwage = 30;
Note: The variable must be declared first, then assigned a value, and finally used (value/or call or write this variable name)
- When to use escape characters
When we need to enter some special characters in a string, such as quotation marks, line breaks, and unspaces, we need to use escape characters.
An escape character is a character with a "\" + a letter to form a character of special significance.
- When a value assignment operator or arithmetic operator performs an operation, the type of the operand to be involved in the operation must be the same, and the operation result must be of the same type as that of the operand.
- How to complete exception capture in C #
Try
{Errors may occur.CodeWritten here}
Catch
{Error message (processing after an error )}
How to execute the above program:
If there is no error in the code in try, the program runs normally and does not execute the content in catch.
If an error occurs in the code in try, the program immediately jumps into catch to execute the code, the code after the error code in try will not be executed.