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;
More Related Contents:
- Change private static final field using Java reflection
- private final static attribute vs private final attribute
- Closest Ruby representation of a ‘private static final’ and ‘public static final’ class variable in Java?
- What is the use of a private static variable in Java?
- Private class property visible
- “Non-static method cannot be referenced from a static context” error
- Why is the Java main method static?
- Static Block in Java [duplicate]
- Why isn’t calling a static method by way of an instance an error for the Java compiler?
- How can I get a resource content from a static context?
- Are Java static initializers thread safe?
- How to instantiate non static inner class within a static method?
- Can I override and overload static methods in Java?
- Why isn’t a qualified static final variable allowed in a static initialization block?
- Should a “static final Logger” be declared in UPPER-CASE?
- Java: Static Class?
- How do I create a static local variable in Java?
- Java Error: Cannot make a static reference to the non-static method
- When NOT to use the static keyword in Java?
- Java static serialization rules?
- Java static final values replaced in code when compiling?
- Is it possible to override a static method in derived class?
- Private methods in Inheritance
- Why we should not use protected static in java
- How to extend a final class in Java
- Should all methods be static if their class has no member variables
- Why is a static class illegal in Java?
- Is an enum constant-specific class body static or non-static?
- Public static variables and Android activity life cycle management
- Static variables and multithreading in java