博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
崩溃java (打印当前类的地址)
阅读量:4673 次
发布时间:2019-06-09

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

public class Testww {
public String toString(){
  return "CrashJava address :"+this+"\n";
}
   public static void main(String []args){
  
  Vector v=new Vector();
  for(int i=0;i<10;i++){
  v.addElement(new Testww());
  System.out.print(v);
  }

   }

“+"会将后面的东西(this)转换成一个字符串,调用toString()方法,将会出现递归调用,导致栈溢出

转载于:https://www.cnblogs.com/yeemi/p/7470194.html

你可能感兴趣的文章
[STL]用法
查看>>
PostgresException: 42883: function ifnull(integer, integer) does not exist
查看>>
python3 表情符号编码
查看>>
桥接模式
查看>>
跨server传输数据注意事项
查看>>
使用蒙版--渐变--制作瓶子倒影
查看>>
后代元素 span:first-child{...}
查看>>
LeetCode 540. 有序数组中的单一元素(Single Element in a Sorted Array) 42
查看>>
codevs 5958 无
查看>>
htaccess 实现网址缩短
查看>>
第四周作业&&结对编程
查看>>
12. 构造代码块
查看>>
指针函数与函数指针的区别
查看>>
HDOJ 4734 数位DP
查看>>
我的第一个python web开发框架(15)——公司介绍编辑功能
查看>>
win10
查看>>
JS DOM操作基础
查看>>
DataSet.GetBookMark内存泄漏
查看>>
get请求中params参数的使用
查看>>
[LeetCode] 617. Merge Two Binary Trees
查看>>