First lesson on Android training (some notes)

Source: Internet
Author: User

6, Java Three kinds of annotation://(single line),/* * * * (multiple lines),/** */(can generate text)

7. Identifiers:

By letters, numbers, underscores, dollar signs;

Note: You cannot start with a number, you cannot use a keyword (49);

Sensitive to case, length unlimited;

For: Variable, class name, method name;

8, constant: immutable;

Note: null, ""; the first represents an empty object and the second represents a null character;

9, variable: can change;

Variables include: variable name, variable type, scope;

Variable classification:

Local variables: Inside the class, inside the method body;

Member variables: Inside the class, outside of the method body;

Note : The value of the member variable may not be initialized, while the local variable must be initialized when used;

10, the basic type: Also called the original ecological class;

Byte,short,int,long,char,double,float,boolean;

Precautions : Byte,short,char is converted to int type by default when it is operated, and if Long,float is defined, note the suffix (l,f);

11. Operators:

(1) arithmetic operator: +,-, *,/,%,++,--;

Note: a++: First operation after a plus 1,++a: first a plus 1 after operation;%: Main purpose: Used to determine whether two numbers can be divisible;

(2) relational operator:<,>,<=,>=,==,!=; Final type: Boolean type;

(3) logical operator:!,&,|,^,&&,| |;

Note that the difference between:& and &&, the first is that no matter how you have to execute both sides of the expression, the second as long as the first is false, will not be executed on the other side of the expression; (efficiency problem, first the latter)

(4) assignment operator: =; always the right value is assigned to the left;

(5) Extension operator: +=.-=,*=,/=,%=;

It can solve the problem of strong transfer internally;

(6) connection operator: +;

Int+int=int;

int+string=string;

int+string+int=string;

12, strong transfer problem:

Definition: The capacity is large to the capacity of small needs strong turn, the contrary is not used;

Solve computational problems, and also bring in defects (possible numerical overflow);

Suggest can not strong turn is not strong turn;



After-school assignments:

The output is as follows:

--------------------

October 30, 2014 * * * *

Thursday ***************

22:00**************

xxxx*************

--------------------

Program:

public class test{

public static void Main (string[] args) {

System.out.println ("------------------------");

System.out.println ("*****2014 October 30 * * * * * * *")

System.out.println ("********* Thursday *********");

System.out.println ("*********21:32*********");

System.out.println ("------------------------");

}

}




This article is from the "Kun" blog, please be sure to keep this source http://linyingkun.blog.51cto.com/2393912/1569873

First lesson on Android training (some notes)

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.