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
Post a Comment