java - Is there a way on getting Scanner input without having to create an instance of the class? -


let's have code:

scanner scan=new scanner(system.in); char x = 'h', aux; system.out.println("insert single letter"); aux=scan.nextline().charat(0); if (x==aux)system.out.println("match"); 

is there way avoid

scanner scannerobject = new scanner(); 

and work done function tool c's scanf() or fget()? confused this!

you don't have use scanner input in java. scanner high level class parsing input while reading it. can read static inputsteam system.in. want wrap in bufferedreader though since want deal strings more byte arrays.

e.g.

bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string line = br.readline(); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -