It is taking int values declared in main. But I want to use char A ,char B declared as instance variables. Means I want Output as Only A Only B Only C . How can I use Char instance variables in switch case???
If you convert (char)10, you'll get the ASCII equivalent of 10, which is neither A,B or C. Hence the compiler chooses "default", and prints its value. But then, since you haven't mentioned the break; statement after default, it continues to execute other statements in the switch case bundle [till end, or until it encounters a break], and hence you are getting this output.