Summary of the third week of Zhao Sumin, T58-Andriod class

Source: Internet
Author: User

Date:11Month8Day(Monday )-Saturday, November 13)

Knowledge Point

Master?

Unknown causes and measures

Chapter 10: Functions of files and streams (1)

(1) Introduction to the file class

Ø
File class directly processes files and file systems, used to process or obtain information related to disk files.

Ø
The hierarchical structure of file browsing sub-directories. the Java Convention uses "/" as the path separator. Use of the constructor: 1) file F1 = new file ("/"); file in the root directory 2) File
F2 = new file ("/", autoexec. BAT); batch files under the root directory.

Ø
File defines many methods to get the standard attributes of a file object. 1) getname () returns the file name; 2) getparent () returns the parent directory name; 3) exists () returns true if the file exists; otherwise, false. 4) check whether the isdirectory () method is a file and return an existing list. 5) List () returns an existing list to list the direct lower layers. 7) file () files = file. listfiles (); string files = file. List (); the former has a size, and the latter has no size.

Ø
A directory is a file class that contains other files and path lists.

(2) stream

Ø
Definition: a stream is a data pipeline.

Ø
Function: stream is the input and output of data, which exists in the Java. Io package.

Ø
The output stream is the input stream of the program.

Ø
Stream classification: 1) byte stream 2) byte stream

Ø
Byte stream: used to process the input and output of bytes. There are two abstract class definitions: inputstream and outputstream, which are used to process input and output respectively.

Ø
Character stream class: used to process character input and output. There are two abstract classes: reader and writer. There are two important methods: Reade () and write (). They read and write character data respectively.

Ø
Standard data streams: 1) system. In standard input streams; 2) system. out standard output streams; 3) system. Err standard error output streams.

(3) Use of byte streams

Ø
Inputstream and outputstream

Ø
Fileinputstream and fileoutputstream

Ø
Datainputstream and dataoutputstream

Ø
Bytearrayinputstream and bytearryoutputstream

Basic knowledge, not very skilled.

Multiple exercises.

Chapter 2: Application of files and streams (II)

(1) Use of the livestream:

Ø
Reader and writer

Ø
Filereader and filewriter

Ø
Bufferedreader and bufferedwriter

Ø
Printwriter

(2) Use of the conversion stream:

Ø
Use of inputstreamreader and outputstreamwriter

Basic knowledge, not very skilled.

Multiple exercises.

Chapter 1: Application of collections (1)

(1) Java collections

Ø
Collection classes store object references instead of objects.

Ø
Set types include set, list, and map ).

Ø
Set: this is a set that does not sort objects in a specific way, but simply adds objects to the set. There cannot be duplicates in the set. Hashset and treeset.

Ø
List: The main feature is that its objects are stored in a linear manner, with no specific order. There is only one beginning and one end. Vector: Like an array, it automatically increases the capacity. Using subscript to store and retrieve objects is like in a standard array. STACK: derived from a vector, adds a post-first-out storage structure for method implementation. Linklist: implements a list that can be used like stacks and queues. Array list to implement an array.

Ø
Hasing: hashtable: implements a ing. All keys must be non-empty. Hashmap: implements an image that allows empty objects to be stored and empty objects to be stored. Treemap objects are arranged in ascending order of keys.

Ø
A collection class can only accommodate objects. All objects contained in the Collection class are instances of the object class. You must reshape a set Member before using it.

Ø
The element types in the container are all objects. When getting an element from the container, you must convert it to the original type.

Ø
The collection interface is a set of objects that can be repeated. The set and list interfaces inherit from the collection interface.

(2) List Interface

Ø
Common classes that implement the list interface include vector, stack, arraylist, and sorted list.

Ø
The vector class implements variable arrays. Can be accessed by subscript ., If the capacity is full, it will be twice the original capacity.

Ø
Vector Construction Method: vector () constructs an empty vector so that the size of its internal data array is 10, and its standard capacity increment is zero.

Vector (collection <? Extends E> C) construct a vector containing elements in the specified set, which are arranged in the order returned by the iterator of the set.

Vector (INT initialcapacity) uses the specified initial capacity and the Capacity Increment equal to zero to construct an empty vector.

Vector (INT initialcapacity, int capacityincrement) uses the specified initial capacity and capacity increment to construct an empty vector.

Ø
STACK: Stack, followed by first-in-first-out.

Ø
Arraylist implements an array of variable sizes.

(3) map-type set

Basic knowledge, not very skilled.

Multiple exercises.

Chapter 2: Application of collections (II)

(1) iterator

Ø
Traverse the data in the set.

Ø
It mainly implements the traversal of the set and map interfaces.

Ø
The iterator is not useful for List classes.

Ø
Integrator interface, three methods: hasnext (), next (), remove ().

(2) Set

Ø
The object added to the set must define the equals () method to determine whether the object to be added is equal to an existing object and thus establish uniqueness.

Ø
Hashset does not allow empty elements.

(3) Generic

Ø
Generic is to forcibly specify a type, which is easier to unify the types.

Ø
Generic Type parameters can only be class types, including custom classes, but not simple types.

Ø
The same generic type can correspond to multiple versions. different versions of the generic type instances are incompatible.

Ø
There can be multiple generic type parameters.

(4) automatic packing and unpacking

Ø
The base type to the class object is boxed.

Ø
Class Object to the basis is to unpack.

Basic knowledge, not very skilled.

Multiple exercises.

Chapter 2: Gui

(1) AWT usage

(2) concept and use of the authorization event model

(3) how to use the swing control.

(4) understand the container, event listening, and layout.

 

Basic knowledge, not very skilled.

 

 

 

 

Legacy problems

The things mentioned this week are not very difficult, but complicated and trivial. As a result, they are not so handy.

Solution

Take a look at the API documentation.

Gains this week

I learned a lot of trivial things this week, but I feel a little unfamiliar. But I still understand a lot of things that I didn't know before, such as packing and unpacking.

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.