Will this line
bufferedReader.readLine();
Without saving it into a variable will consume memory?
Will this line
bufferedReader.readLine();
Without saving it into a variable will consume memory?
Yes, it will consume memory because it at the very least it has to allocate memory for the result (even if you don't assign it).
Probably, the memory will be garbage collected fairly soon because no one is holding a reference to it. But there's no guarantees when the garbage collector will be run. And to answer the question is doesn't matter anyway because it isn't about the time frame the memory is allocated.
Please also note that it will definitely not be "optimised away" because it triggers a side effect which has to be performed even if the result is discarded immediately. The compiler&JVM "know" that and therefore from a memory point of view this is pretty much just like assigning the result and then immediately overwriting the result with something else.
As far as i know, it would be available for Garbage Collection immediately, because it doesn't has any references attached to it.