开发者

Compilation error in NetBeans

开发者 https://www.devze.com 2023-03-15 08:43 出处:网络
Any idea why this code in NetBeans 7 flags line with Deletion (Deletion is a class within client package) as an error?

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 MUTA开发者_StackOverflow中文版TION_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");


You haven't really given enough info but try

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


Alternatively, if you're not assigning d, you can just simply call the object directly, like so:

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

精彩评论

暂无评论...
验证码 换一张
取 消