I am using javaparser to parse a java file , when I count the "If" statement it display the output as an incremental number such that Eg: if there are two "if" statements then it displays as [ 1 2 ]
I want to get only the total number of "IF" statements. eg: 2
This is my source code.
private static class IfStmtVisitor extends VoidVisitorAdapter<Void> {
int i=0 ;
@Override
public void visit(IfStmt n, Void arg) {
//visit a if statement, add 1
i++;
{System.out.println( i );}
}
Aucun commentaire:
Enregistrer un commentaire