Is this error about not finding a variable a scope problem?
I am doing a parse program.this is my main file. I create an instance class of indentifier in the main file but it cant compile. error showing that inside the if statement dataArrary.lineStart(limiterNum,lineNum);
cannot find dataArray symbol.So i did miss something ? is that a scope problem?
public static void main(String[] args){
BufferedReader reader = null;
String line = "a";
try{
indentifier dataArray = new indentifier();
reader = new BufferedReader(new FileReader("Discount.开发者_如何学Cjava"));
Pattern a = Pattern.compile(".*for(.*)[{]");
Pattern b = Pattern.compile(".*while(.*).*[{]");
Pattern c = Pattern.compile(".*if(.*)[{]");
Pattern d = Pattern.compile(".*[}]");
Pattern e = Pattern.compile(".*class.*[{]");
Pattern f = Pattern.compile("(.*)[{]");
while(line != null){
line = reader.readLine();
Matcher mfor = a.matcher(line);
Matcher mwhile = b.matcher(line);
Matcher mif = c.matcher(line);
Matcher mend = d.matcher(line);
Matcher mclass = e.matcher(line);
Matcher mfunc = f.matcher(line);
if (mclass.matches() == true){
dataArrary.lineStart(limiterNum,lineNum);
limiteradd(0);
continue;
}
again,if i miss something on the internet. Please show me anykey word or links to point me out.thank you very much
That's a typo. You declare dataArray
, but use dataArrary
.
You wrote dataArrary
instead of dataArray
. Misspell.
I can't find dataArrary
either, perhaps you meant dataArray
which to declared earlier.
I tend to use my IDE's code completion to avoid such issues (and save typing) In my IDE can can write da
and <ctrl>+<space> and it gives me a list of possible symbols I can use. That way I save a few key presses and its usually right.
精彩评论