Java_加深return this_public String toString方法

class Test{

String name="小明";

public Test get(){ 

return this; //返回当前对象

}

public static void main(String[] args){

Test c = new Test();

System.out.println(c.get().name); 

}

}

方法连https://blog.csdn.net/pmcasp/article/details/82904689

输出:小明

 

class Test2{

public String toString(){

return "字符串";

}

public static void main(String args){

Test2 tt=new Test2();

System.out.println(tt);

}

}

输出:字符串

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
package main.java.reader.bean; public class BForm { String jy_id,jy_name,b_isbn,b_name; String jy_date,gh_date,is_gh; int jy_count; public String getJy_id() { return jy_id; } public void setJy_id(String jy_id) { this.jy_id = jy_id; } public String getJy_name() { return jy_name; } public void setJy_name(String jy_name) { this.jy_name = jy_name; } public String getB_isbn() { return b_isbn; } public void setB_isbn(String b_isbn) { this.b_isbn = b_isbn; } public String getB_name() { return b_name; } public void setB_name(String b_name) { this.b_name = b_name; } public String getJy_date() { return jy_date; } public void setJy_date(String jy_date) { this.jy_date = jy_date; } public String getGh_date() { return gh_date; } public void setGh_date(String string) { this.gh_date = string; } public String getIs_gh() { return is_gh; } public void setIs_gh(String is_gh) { this.is_gh = is_gh; } public int getJy_count() { return jy_count; } public void setJy_count(int jy_count) { this.jy_count = jy_count; } @Override public String toString() { return "BForm [jy_id=" + jy_id + ", jy_name=" + jy_name + ", b_isbn=" + b_isbn + ", b_name=" + b_name + ", jy_date=" + jy_date + ", gh_date=" + gh_date + "]"; } public BForm() { super(); // TODO Auto-generated constructor stub } public BForm(String jy_id, String jy_name, String b_isbn, String b_name, String jy_date, String gh_date) { super(); this.jy_id = jy_id; this.jy_name = jy_name; this.b_isbn = b_isbn; this.b_name = b_name; this.jy_date = jy_date; this.gh_date = gh_date; } }
06-11

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mr_Pmc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值