Java Program to Clear the StringBuffer - Programiz
In this example, we will learn to clear the string buffer using the delete() and setLength() method and creating a new StringBuffer object in Java.
In this example, we will learn to clear the string buffer using the delete() and setLength() method and creating a new StringBuffer object in Java.
Write and run Python code using our online Python compiler (editor) that's blazing fast and easy to use for beginners. Enjoy additional features like code sharing and code visualization.
Data in the file: First Line Second Line Third Line Fourth Line Fifth Line. In the above example, we have used the BufferedReader Class to read the file named input.txt. Example 3: Java Program to Read File Using Scanner. import java.io.File; import java.util.Scanner
Get Started With Java. Your First Java Program.For example, main.java is a Java file that contains information about the Java program. A directory is a collection of files and subdirectories. A directory inside a directory is known as subdirectory.