您可以使用注释来标记代码。除此之外,有没有办法将代码块或代码行标记为实验性/仅用于测试目的?
java中的伪代码 -
public SpecialObject importantMethod(){
System.out.println("Ready to go into if else"); // Test Code: Delete Later !
if(condition after a big series of method calls){
System.out.println("Entered into if"); // Test Code: Delete Later !
//execute code which is critical to program
}else
{
System.out.println("Entered into else"); // Test Code: Delete Later !
//execute code which is critical to program
}
return specialObject;
}
public void anotherImportantMethod(){
SpecialObject obj = importantMethod();
//do something important with obj
}