Home  >  Article  >  Java  >  What does java t mean?

What does java t mean?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-12-27 11:16:105435browse

What does java t mean?

In JAVA, means generic.

It means that another class needs to be used in the Tree class, but the specific type of the class to be used cannot be determined, so T is used instead for the time being.

When the specific program knows what type to use, use that type instead of T. For example, if you need to instantiate a Tree class and the class that needs to be used is String, then you can do this to instantiate Tree().

What does java t mean?

Definition classification

There are mainly two types of definitions of generics:

1. In program coding Some types contain type parameters, which means that generic parameters can only represent classes, not individual objects. (This is a more common definition today)

2. Some classes that contain parameters in program coding. Its parameters can represent classes or objects, etc. (People mostly refer to this as templates.) Regardless of which definition is used, the parameters of the generic must be specified when the generic is actually used.

Some strongly typed programming languages ​​support generics, the main purpose of which is to enhance type safety and reduce the number of class conversions. However, some programming languages ​​that support generics can only achieve part of the purpose.

PHP Chinese website has a large number of free JAVA introductory tutorials, everyone is welcome to learn!

The above is the detailed content of What does java t mean?. 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
Previous article:How to read txt in javaNext article:How to read txt in java

Related articles

See more