gpt4 book ai didi

java - NetBeans 中的编译错误

转载 作者:行者123 更新时间:2023-12-01 15:49:15 25 4
gpt4 key购买 nike

知道为什么 NetBeans 7 中的这段代码将 Deletion(Deletion 是客户端包中的类)标记为错误吗?

package client;

/**
*
* @author Arth
*/
public class Client_Main
{
final String ORIGINAL_SEQUENCE = "AAGCTGT";

// Sample sequences demonstrating each type of DNA error
final String MUTATION_SEQUENCE = "AATCTGT";
final String TRANSPOSITION_SEQUENCE = "AAGTCGT";
final String INSERTION_SEQUENCE = "AAGACTG";
final String DELETION_SEQUENCE = "AGCTGTA";

final String SEQUENCE_A = "AAAAACCCCCGGGGGTTTTT";
final String SEQUENCE_B = "AAAACACCCCGGGGGTTTTT";

public void check()
{
Deletion d("1","2");
}

}

行:

Deletion d("1","2");

产生错误:

';' is expected

最佳答案

此语法非法。如果您想创建一个新对象,您应该使用就地初始化:

Deletion d = new Deletion("1", "2");

或在声明后初始化:

Deletion d;
d = new Deletion("1", "2");

关于java - NetBeans 中的编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6453566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com