Discuss / Java / 互相通信

互相通信

Topic source

🌙

#1 Created at ... [Delete] [Delete and Lock User]

尝试一下,服务端,这样也太无聊了...

记得有价值百万的 人工智能代码,和这个服务端有点像

🌙

#2 Created at ... [Delete] [Delete and Lock User]

public class AI {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String question;

        while (true){

            question = scanner.next();

            question = question.replace("吗","");

            question = question.replace("我","我也");

            question = question.replace("?","!");

            System.out.println(question);

        }

    }

}

🌙

#3 Created at ... [Delete] [Delete and Lock User]

大致想了一下,和客户端一样 用scanner 应该能实现 相互通信,,,有兴趣的同学,可以试试,挺好玩的

最好2个人在一个局域网

👀

#4 Created at ... [Delete] [Delete and Lock User]
question = question.replace("吗","");
            question = question.replace("我","我也");

大佬 这三行代码是什么作用🤦‍


  • 1

Reply