简体   繁体   中英

Compilation error in NetBeans

Any idea why this code in NetBeans 7 flags line with Deletion (Deletion is a class within client package) as an error?

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");
         }

}

The line:

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

produces the error:

';' is expected

This syntax is illegal. If you want to create a new object you should either use in-place initialization:

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

or initialize after the declaration:

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

您尚未真正提供足够的信息,但请尝试

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

另外,如果不分配 d ,则可以直接直接调用该对象,如下所示:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM