Ways to read Data From the Console in Java || Lesson 69 || Java Programming || Learning Monkey || смотреть онлайн
Ways to read Data From the Console in Java
In this class, We discuss Ways to read Data From the Console in Java.
The reader should have prior knowledge of input and output streams. Click here.
The below example uses a buffered reader class.
Example:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class test
{
public static void main(String args[])throws IOException
{
BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));
String name = reader.readLine();
System.out.println(name);
}
}
The class input stream reader is used to convert bytes to characters.
The object system.in is given as a parameter to input stream reader class
The input stream reader object is given as a parameter to the buffered reader.
The buffered reader class will assign some buffer space to store the data read from the stream.
Instead of reading data from the console each time, Read the buffer data.
The data is read from the buffer to provide speed access.
We can use the methods present in the buffered reader class.
To read the data line by line, use the readline() method.
Another way to read data is by using the scanner class.
Example:
Import java.util.Scanner;
public class test
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
String s = in.nextLine();
System.out.println(“You entered string ” + s);
int a = in.nextInt();
System.out.println(“You entered integer ” + a);
float b = in.nextFloat();
System.out.println(“You entered float ” + b);
}
}
The scanner class had so many methods.
We can read data based on int, float, short, etc.
The above example uses methods to read the next line, next int, and next float.
Link for playlists:
https://www.youtube.com/channel/UCl8x4Pn9Mnh_C1fue-Yndig/playlists
Link for our website: https://learningmonkey.in
Follow us on Facebook @ https://www.facebook.com/learningmonkey
Follow us on Instagram @ https://www.instagram.com/learningmonkey1/
Follow us on Twitter @ https://twitter.com/_learningmonkey
Mail us @ [email protected]
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Ways to read Data From the Console in Java || Lesson 69 || Java Programming || Learning Monkey ||» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.