Android Java basic example code

Source: Internet
Author: User

Android interfaces are generally developed in Java, so for C ++ ,. for net personnel, there is an adaptation process for understanding and writing. Recently, I have referred to the relevant materials and used some of these Java basics as an example.CodeTo record the familiar process of the platform.

File directory (mainly related to Java syntax)

Annotdefine. Java
Annotdemo. Java classdemo. Java
Coderesource_en_us.java collection. Java
Demo. Java example_en_us.properties
Generic. Java initdemo. Java
Io. Java localresource. Java
Nest. Java prefsdemo. Java
Threaddemo. Java

:

Http://cid-56b433ad3d1871e3.office.live.com/self.aspx/.Public/AndroidJava.rar

For the syntax differences between Java and C #, refer to an interesting website:

Http://www.harding.edu/fmccown/java_csharp_comparison.html

The following are some brief descriptions (JDK). For specific usage and descriptions, refer to the above examples.

Collections framework

Package: Java. util

Interface

Core and hierarchical relationships

Iterable, collection, list, set, sortedset, queue, map, and sortedmap.

Implementation class

Implementation conventions:

Abstract begins with an abstract class, used to reduce repeated code for multiple implementations

The specific class ends with the interface name, such as the list interface implemented by arraylist

The following is a list of implementation classes in JDK:

Abstractcollection, abstractlist, abstractqueue, abstractsequentiallist, abstractset,

Keywords, arraydeque, arraylist, attributelist, concurrentlinkedqueue, queue, delayqueue, enumset, hashset, delimiter, linkedblockingdeque, delimiter, linkedhashset, sorted list, delimiter, role, rolelist, role, stack, synchronousqueue, treeset, Vector

Tool

Array and container traversal methods

Collection <string> Col =...

Iterator iter = col. iterator ();

While (ITER. hasnext ())

System. Out. println (ITER. Next ());

For (string S: COL)

System. Out. println (s );

Nested type nested type

There are four kinds of Nested classes: static member classes, nonstatic member classes, anonymous classes, and local classes. The latter three categories are known as inner classes.

Annotation type annotations

Java. Lang

Deprecated
Override
Suppresswarnings

Java. Lang. Annotation

Documented
Inherited
Retention
Target

Javax. Annotation

Generated
Postconstruct
Predestroy
Resource
Resources

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.