"Why it is allowing me to type no: in console space even though I have not used SCanner class" because you don't need a
Scanner
to be able to type in a console. You need Scanner
to read what you typed, but unless input is explicitly blocked a console will always allow you to type stuff. What happens to that stuff you typed is a different matter.