We willLet's analyze your program first.. In your program, your first method is main()main(),and and keep it in mind it is the static method..then. Then you declare the local variable for that method (compareCount,low low, high,etc etc..).Scope The scope of this variable is only with in the declared method record less, regardless of it isbeing a static or non static method.So So you can't use those variables out sideoutside that method..This This is the basic error u did.made.
Then we'llwe come to next point..you You told static is killing you.. (It may killsbe killing you but it'sit only gives life to your program..!!)first u First you must understand the basic thing.. *static*Static method calls only the static method..and only and use only the static variable.. *static*Static variable or static method are not dependdependent on any instance of that class.. (ie,if ui.e. If you change any state of the static variable it will reflectsreflect in all objects of the class).. *Because of this u calyou call it as a class variable andor a class method.. And Lota lot more is there about static.the "static" keyword. iI hope now u got someyou get the idea..first First change the scope of the variable and declare it as a static (because ofto be able to use it in static methods)..
And the directionadvice for you is..,you missed: you misunderstood the idea of the scope of the variables and static functionalities..get Get clear idea about that..