Home > Java > JavaBase > What does mean in java

What does mean in java

王林
Release: 2020-02-03 11:39:25
Original
8337 people have browsed it

What does <E> mean in java

in java means generic, which means any type.

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

HashMapK, V is the same as E. HashMap 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();
Copy after login

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();
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template