-5

I have this error:

non-static variable scan cannot be referenced from a static context


Question has been improved.

1) Posted a code instead of a pic.

2) Improved a formatting and question itself.

Qui-Gon Jinn
  • 2,786
  • 3
  • 22
  • 26

1 Answers1

2

Try to declare the class variables as static. So you will have:

static char val;
static Scanner scan = new Scanner(System.in);
Awaa
  • 168
  • 13