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 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");
精彩评论