标签:return message dem ESS pack send div color connect
今天看到一个很不错的this使用demo:
package com.toov5.Reordering; class Message1{ private Channel channel; private String title; private String content; public Message1(Channel channel,String title, String content) { this.channel=channel; this.title=title; this.content=content; } public void send(){ if (this.channel.isConnect()) { System.out.println("发送消息title"+this.title+"conten"+this.content); }else { System.out.println("无法发送"); } } } class Channel{ private Message1 message; public Channel(String title, String content) { this.message=new Message1(this, title, content); this.message.send(); } public boolean isConnect(){ return true; } } public class ThisTest { public static void main(String[] args) { Channel ch = new Channel("toov5", "happy"); // Message message = new Message(ch, "toov2", "happy"); // message.send(); } }
标签:return message dem ESS pack send div color connect
原文地址:https://www.cnblogs.com/toov5/p/9847587.html