[Java] Scanner VS BufferedReader

jipyo park·2022년 6월 7일
0

java

목록 보기
3/5
//Scanner 사용
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    }
}
// BufferedReader 사용
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException {
    	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    }
}

Parsing

Scanner는 Stream에서 정규표현식을 통해 구문분석을 하여 parsing.
BufferedReader는 just Reading.

Buffer 크기

Scanner Buffer Size : 1KB
BefferedReader Buffer Size : 8KB

동기화

Scanner : 단일 쓰레드
BufferedReader : 다중 쓰레드

BufferedReader는 Single Thread를 사용하는 Scanner보다 느리다
하지만 Parsing을 해주는 것 때문에 Scanner가 조금 더 느리게 작동

참고

11개의 댓글

comment-user-thumbnail
2022년 9월 18일

Well to know about the programming help here would be wise. The beginners who really want to fix the problem with they able to grab on https://www.mepits.com/product/2190/diy-kits/simple-diy-project-heartbeat-sensor here. Thumbs up with your further information online about programming that is recommending.

답글 달기
comment-user-thumbnail
2023년 8월 1일

The updates from the development side are pretty useful and helping for beginners. There should be people who might look for coding problem solutions can avail of supplement manufacturers information online. Continue with your tremendous work hope that is beneficial.

답글 달기
comment-user-thumbnail
2023년 8월 2일

An embryologist is a specialized scientist who handles the eggs, and embryos in the laboratory. They are responsible for fertilizing IVF Kosten of eggs, monitoring embryo development, and selecting the healthiest embryos for transfer.

답글 달기
comment-user-thumbnail
2023년 8월 10일

To truly harness the potential of AI in video editing, a holistic approach is crucial. Editors must understand the technical aspects of ai video generator algorithms while maintaining a clear artistic vision. By embracing AI as a tool rather than a replacement.

답글 달기
comment-user-thumbnail
2023년 10월 6일

The world is changing at an unprecedented pace. New technologies, industries, and ways of working emerge regularly. Lifelong learning equips individuals with the best essay writing service for college students tools they need to adapt to these changes, fostering resilience and the ability to thrive in uncertain environments.

답글 달기
comment-user-thumbnail
2024년 1월 6일

Celebrities extends far beyond red carpets and screens a significant number of stars have embraced a profound responsibility their biographyofacelebrity role in driving positive change through philanthropy.

답글 달기
comment-user-thumbnail
2024년 5월 2일

As a student with a hectic schedule, finding the time to write essays can be a struggle. That's where Essays for sale https://essayhub.com/essays-for-sale comes to the rescue! Their service has been a game-changer for me, providing well-written and meticulously researched essays tailored to my needs. Not only do they save me valuable time, but their work also helps me understand complex topics better. With their assistance, I can focus on other academic tasks and extracurricular activities without compromising on quality.

답글 달기
comment-user-thumbnail
2024년 6월 11일

The choice between Scanner and BufferedReader in Java often hinges on the specific requirements of a program. Scanner is user-friendly and versatile, ideal for parsing primitive types and strings using regular expressions. BufferedReader, on the other hand, excels in reading large volumes of text efficiently, making it suitable for performance-critical applications. In computer science, understanding the intricacies of these tools highlights the importance of selecting appropriate data handling methods to optimize performance and maintain code readability. Both topics underscore the balance between ease of use and efficiency, a core principle in computer science education and practice.

Visit for more information and help : https://myassignmenthelp.co.uk/java-assignment-help.html and https://myassignmenthelp.co.uk/computer_engineering_assignment_help.html

답글 달기
comment-user-thumbnail
2024년 11월 7일

thank you very much for these useful tips, I really need it to develop my blog page

답글 달기
comment-user-thumbnail
2024년 11월 7일

thank you very much for these useful tips, I really need it to develop my blog page

답글 달기
comment-user-thumbnail
2024년 11월 7일

thank you very much for these useful tips, I really need it to develop my Drift Boss blog page

답글 달기