社区
Java SE
帖子详情
怎样去掉集合显示结果中的"[ ]"和","
大铁刷子
2005-10-28 10:29:07
结果如:[a,b,c,d]
显示为:abc
...全文
201
3
打赏
收藏
怎样去掉集合显示结果中的"[ ]"和","
结果如:[a,b,c,d] 显示为:abc
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
abcd9845
2005-10-29
打赏
举报
回复
import java.util.Vector;
public class vec
{
public static void main(String args[])
{
Vector ve1 = new Vector();
ve1.addElement("1");
ve1.addElement("a");
ve1.addElement("b");
ve1.addElement("2");
ve1.addElement("d");
System.out.println (ve1);
System.out.println (ve1.toArray()[0]);
System.out.println (ve1.toArray()[1]);
}
}
zzhzzh204553
2005-10-28
打赏
举报
回复
知道你的意思,你直接调用是它们的toString()方法,然后打印的吧.
这样不行,你要自己写个打印方法,把那个集合对象做为参数,就行了.
believefym
2005-10-28
打赏
举报
回复
String tmp = collection.toString();
tmp = tmp.substring(1,tmp.length()).replaceAll(",","");
System.out.println(tmp);
LeetCode 232: Implement Queue using Stacks
Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(
leetcode 232:Implement Queue using Stacks
leetcode 232:Implement Queue using Stacks python java c++
LeetCode232 Implement Queue using Stacks Java 题解
题目: Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front eleme
232. Implement Queue using Stacks
Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue. peek() -- Get the front element. em...
Leetcode_232_Implement Queue using Stacks
本文是在学习
中
的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/48392363 Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue.pop
Java SE
62,620
社区成员
307,251
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章