-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
  • 3,722
  • 3
  • 25
  • 32

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
  • 178
  • 13