How to Print Fast Output in Competitive Programming using Java? Last Updated : 16 Aug, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In Competitive programming, most of the students use C++ as their primary language as it is faster than the other languages(e.g Java, Python) but for a student/professional who use Java as his/her primary language taking Input from input streams and printing fast output is the main difficulty faced during contests on competitive platforms(eg. CodeChef, CodeForces, Spoj, etc). In this article, there defined the fastest method to print O/P using Java (Mainly in Competitive Programming). BufferedWriter Class: It writes text to a character-output stream, buffering characters to provide for the efficient writing of single characters, arrays, and strings. It makes the performance fast. BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); Methods of BufferedWriter: write(): writes a single character to the internal buffer of the writer.write(char[] array): writes the characters from the specified array to the writer.write(String data): writes the specified string to the writer.flush(): used to clear the internal buffer.close(): used to close the buffered writer.Below is the implementation of the problem statement: Java // Print fast Output in Competitive Programming using JAVA import java.io.*; class GFG { public static void main(String[] args) throws Exception { String[] gfg = { "Geeks", "For", "Geeks" }; BufferedWriter output = new BufferedWriter( new OutputStreamWriter(System.out)); for (int i = 0; i < gfg.length; i++) { output.write(gfg[i] + "\n"); } output.flush(); } } OutputGeeks For Geeks Comment More infoAdvertise with us Next Article Fast I/O in Java in Competitive Programming S sagar797 Follow Improve Article Tags : Java Technical Scripter 2020 Practice Tags : Java Similar Reads Fast I/O in Java in Competitive Programming In competitive programming, fast input and output (I/O) are essential to avoid time limit exceeded (TLE) errors. Java can be slower for I/O tasks, but there are different ways to speed it up. Using methods like BufferedReader, Scanner, and custom input classes, we can improve the performance of our 6 min read Java tricks for competitive programming (for Java 8) Although the practice is the only way that ensures increased performance in programming contests but having some tricks up your sleeve ensures an upper edge and fast debugging.1) Checking if the number is even or odd without using the % operator:Although this trick is not much better than using a % 5 min read Setting up Java Competitive Programming Environment An operating system is required to be installed on your system. here we will be discussing the setup in windows. However, you can choose any operating system. Install JDK (Java Development Kit) JDK, is a program that allows you to write Java code from the comfort of your desktop. It contains a varie 5 min read Which Java libraries are useful for competitive programming? Java is one of the most recommended languages in competitive programming (please refer a previous article for more details) Java Collection framework contains lots of containers which are useful for different purposes. In this article, we are going to focus on the most important containers from comp 4 min read Java Generics to Code Efficiently in Competitive Programming Templates are the foundation of generic programming, which involve writing code in a way that is independent of any particular type. These powerful tools can be used for writing our code effectively. Some cool tricks that may be used in Competitive Programming are given as follows: Fast Input/Output 9 min read Why Java Language is Slower Than CPP for Competitive Programming? Choosing the appropriate language while starting competitive programming is the most important factor. Generally, we choose that language that has short syntax and executes very fast or which is familiar to us, and we know all the working patterns of that particular whether it is Java or C++. Most o 5 min read Like