- package com.lan.generic;
- import com.sun.accessibility.internal.resources.accessibility;
- //自定义类上的泛型
- public class Demo1<T> {
- public void testfuntion() {
- funtion("aaa");
- }
- //自定义带泛型的方法
- public <T>T funtion(T t) {
- return null;
- }
- public <T,E,K>void b(T t,E e,K k) {
- }
- //静态方法泛型定义在static后
- public static<T> void c(T t) {
- }
- }
java自定义泛型(泛形)方法
转载上一篇:钉钉开发笔记(1)
下一篇:JavaBean简单及使用
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java 方法参数使用泛型 java方法的形参
1.形参:用来接收调用该方法时传递的参数。只有在被调用的时候才分配内存空间,一旦调用结束,就释放内存空间。因此仅仅在方法内有效。
Java基础 System 基本数据类型 值调用