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.
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.
Try to declare the class variables as static. So you will have:
static char val;
static Scanner scan = new Scanner(System.in);