需要字符串缓冲区帮助

String buffer help needed

我完全按照字符串缓冲区教程 (https://www.youtube.com/watch?v=hyVmCqiCNmY) 中的说明进行了操作,但是我在 Netbeans 中遇到错误,在这行代码中有一条橙色线

StringBuffer b = New StingBuffer("how are you doing today");

而当我在eclipse中做同样的事情时,没有这样的错误

节目:

public class StringBuff {

    public static void main(String[] args) {
        StringBuffer b = New StingBuffer("how are you doing today");

        System.out.println(b);
    }

}

我尝试添加来自 Netbeans 的程序图像,但我还没有资格添加图像。

看来您在 New 中有错别字。 Java 区分大小写,因此 New 不同于 new

顺便说一句 StringBuffer is supplemented by StringBuilder。橙色线并不表示错误,而是应该改进的代码。

This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.

Read the official Java Tutorial,不是一些 YT 视频。