java - Using \n as delimiter prints an extra empty line -
i have following code:
scanner input = new scanner(system.in); input.usedelimiter("\n") system.out.println(input.next()); system.out.println("end"); when run , type "orange apple" enter, print
orange apple
end
instead of
orange apple
end
which wanted print. have no idea why keeps printing empty line. how can fix this?
system.out.println makes new line opposed system.out.print doesn't. when system.out.println used \n you're making 2 new lines.
Comments
Post a Comment