Learning Java seventh week

Important points

1. "super" usage Constructors and methods, both point to the superclass with the keyword super, but the methods used are not the same. Use this method to perform keyword superclass method is overloaded

 

2. The similarities and differences between the abstract class and interfaces

the same:

1, both interfaces and abstract classes abstract methods, represents the level of abstraction defined;

2, interfaces and abstract classes can not create object.

different:

1, the interface is not configured, there may be an abstract class constructor;

2, the interface has an interface only constants and abstract methods, there may be an abstract class abstract methods, which may have non-abstract methods;

3, modifier abstract methods of the interface does not write, default or abstract public. The abstract class abstract method must write the abstract keyword.

 

4. The collection interfaces

Top-level interface Collection set of all interfaces, including the following methods

Int size();

boolean remove(Object element); //optional

Iterator iterator();

boolean isEmpty();

Boolean add(Element o);

Boolean contains(Object o);

boolean containsAll(Collection<?> c);

boolean addAll(Collection<? extends E> c); //optional

boolean removeAll(Collection<?> c); //optional

boolean retainAll(Collection<?> c); //optional

A collection of interfaces:

1 List List

2 Set collection

3 Map Mapping

4 Iterator iterator

 

Definition and common methods 5.List

List is a sequential Collection (commonly referred to as sequences). List may contain duplicate elements. List the interface basic functions are as follows:

Access by location - access element by element position in the index list.

Query - Get the position of an element in the list of

Iteration - extends Iterator interface enables more features

List subset - Get a range of positions subset List 

List interface as follows:

public interface List<E> extends Collection<E> {

// Positional access

E get(int index);

E set(int index, E element); //opt

Guess you like

Origin www.cnblogs.com/ywqtro/p/11371334.html