Home  >  Article  >  Java  >  What does mean in java

What does mean in java

王林
王林Original
2020-02-03 11:39:258331browse

What does <E> mean in java

1a4db2c2c2313771e5742b6debf617a1 in java means generic, which means any type.

For example: HashMapb77a8d9c3c319e50d4b02a976b347910, you can set K and V to any class when using it.

HashMap601754196720ae8e56f6948b6d2ab654K, V is the same as E. HashMap601754196720ae8e56f6948b6d2ab654 represents a class. This class has two sub-variable types: String and Integer, which can be understood this way.

Recommended learning: java video tutorial

The following program:

Map map=new HashMap<String, String();

State that K (key) and V (value) can only be of String type, Only if all Keys and Values ​​in your map are of type String, the program you write will be compiled.

List list=new ArrayList<Object();

Declare that all E (elements) in the list are of type Object.

Recommended related articles and tutorials: java introductory tutorial

The above is the detailed content of What does mean in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn