博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java接口作为类变量,与方法变量
阅读量:3905 次
发布时间:2019-05-23

本文共 569 字,大约阅读时间需要 1 分钟。

package test_class;import java.util.ArrayList;import java.util.List;public class test_interface {    public static void main(String[] args) {        List
a=new ArrayList<>(); List
b=test_arr(a); for (int i = 0; i < b.size(); i++) { System.out.println(b.get(i)); } } public static List
test_arr(List
list1){//如果不用static 在主函数中便不能使用该方法 list1.add("AAA"); list1.add("BBB"); list1.add("CCC"); return list1; }}

转载地址:http://uamen.baihongyu.com/

你可能感兴趣的文章
testNG介绍
查看>>
SDN
查看>>
NFV SDN
查看>>
SDN Brief Introduction
查看>>
xrange vs range python
查看>>
None Python
查看>>
Naive Pattern Searching
查看>>
Sales Engineer
查看>>
US Shirt Size
查看>>
recursive tree
查看>>
An Introduction to Python Lists
查看>>
gstack - stack trace of a running process
查看>>
strace
查看>>
Mac OS X Install Docker
查看>>
Quickstart containers
查看>>
About the Docker Hub
查看>>
About Docker
查看>>
Hello world in a container
查看>>
Run a simple application
查看>>
Build Your Own Images
查看>>