Use of Private static

ans is defined within the do{ ... } while() loop but it must be defined outside, to make it available for condition in the while.

So do:

char ans = 0;
do {
    Calc op = new Calc();
    Scanner scan = new Scanner(System.in);
    ans = 0;

Leave a Comment