Reading data from keyboard7 Jan 2025 | 1 min read There are many ways to read data from the keyboard. For example:
InputStreamReader classInputStreamReader class can be used to read data from keyboard.It performs two tasks:
BufferedReader classBufferedReader class can be used to read data line by line by readLine() method. Example of reading data from keyboard by InputStreamReader and BufferdReader classIn this example, we are connecting the BufferedReader stream with the InputStreamReader stream for reading the line by line data from the keyboard. Output:Enter your name Amit Welcome Amit Another Example of reading data from keyboard by InputStreamReader and BufferdReader class until the user writes stopIn this example, we are reading and printing the data until the user prints stop. Output:Enter data: Amit data is: Amit Enter data: 10 data is: 10 Enter data: stop data is: stop Next TopicHow Garbage Collection Works in Java |
In the realm of computer networks, efficient data transmission is a critical concern. The sliding window protocol is a well-known technique that plays a significant role in ensuring reliable and orderly data exchange between a sender and a receiver. In this section, we will delve into...
4 min read
In this section, we will understand what is saddle point in a matrix, and how to find the saddle point of a matrix through a Java program. What is the saddle point in a matrix? In a matrix, an element is called the saddle point that is the...
3 min read
A counter variable in Java is a special type of variable that is used in the loop to count the repetitions or to know about in which repetition we are in. In simple words, a counter variable is a variable that keeps track of the...
4 min read
In Java, Future is an interface that belongs to java.util.concurrent package. It is used to represent the result of an asynchronous computation. The interface provides the methods to check if the computation is completed or not, to wait for its completion, and to retrieve the...
24 min read
The XOR (distinctive OR) operation is a logical operation that takes two operands and returns genuine if and most effective if precisely one of the operands is authentic. In Java, the XOR operation is represented by using the caret symbol (^). While the XOR operation...
4 min read
In this article, we are going to learn about a topic known as Parallel Programming. Throughout this article, we will learn why Parallel Programming is used in Java and where it is used. This helps us understand the importance of Parallel Programming and how different it...
6 min read
In this section, we will learn about how we can write the code for by using stars or any other special characters and with the user-defined rows and columns. It is one of the most difficult pattern programs to code in Java. In order to...
2 min read
In programming, sorting is important because it puts elements of an array in a certain order. The widely used order is alphabetical order or natural order. The sorting is used for canonicalizing (the process of converting data in the standard form) data and for producing a...
3 min read
In object-oriented programming, a class that stores and manages a single instance is referred to as a "Mono Class". The concept aligns with the Java Singleton Design Pattern, where a class provides a global point of access to a single instance and ensures its generation. Singleton Design...
4 min read
is a new feature introduced in Java 8. It allows developers to write more concise and readable code by reducing the amount of boilerplate code required for iterating through collections. is a method that is used to iterate through collections and apply a...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India