목록전체 글 (75)
개발도생's Blog

[백준] 1284_집 주소 대문에 붙이는 주소판(호수판) 제작을 위해 입력된 값으로 규격 사이즈에 맞게 출력해 주면 되는 것이다. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true) { int sum = 0; String num = br.readLine(); if(num.charAt(0) == '0')..

[백준] 10480_Oddities 문제 10480번: Oddities Some numbers are just, well, odd. For example, the number 3 is odd, because it is not a multiple of two. Numbers that are a multiple of two are not odd, they are even. More precisely, if a number n can be expressed as n = 2 ∗ k for some integer k, then n www.acmicpc.net 입력 값이 짝수인지 홀수인지 구분해 달라는 문제다. 간단한 수학 문제다. import java.io.BufferedReader; import java.io...

프로그램을 작성할 때 문법에 맞지 않게 코드를 작성할 때 발생하는 문법 오류(Syntax Error), 문법에 맞게 작성이 된 프로그램이 예상하지 못한 오류가 발생해서 동작이 강제로 종료가 되는 경우가 있다. 예상하지 못한 상황이 발생하여 프로그램에 영향이 미치는 것을 '오류(Error)'와 '예외(Exception)' 두 가지로 구분이 가능하다. 오류(Error)는, 시스템 레벨에서 프로그램에 심각한 문제를 야기하여 실행 중인 프로그램을 종료시킨다. 오류는 개발자가 미리 예측하여 처리할 수 없는 것이 대부분이므로, 오류에 대한 처리는 할 수 없다. 예외(Exception)는, 오류와 마찬가지로 실행 중인 프로그램을 비정상적으로 종료시키지만, 발생할 수 있는 상황을 미리 예측하여 처리할 수 있다. 따라서..

[백준] 9772_Quadrants 9772번: Quadrants Given the coordinates (x,y) of some points in 2-dimensional plane, find out which quadrant(Q1-Q4) the points are located. If a point is located on X-axis or Y-axis, print out AXIS instead. www.acmicpc.net x, y의 값이 주어졌을 때 좌표 어디에 점이 찍히는지 물어보는 문제이다. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stri..
String Class는, 자바에서 문자열을 사용할 수 있도록 제공되는 기본 Class 중 하나다. String Class는 문자열과 관련된 작업을 할 때 유용하게 사용할 수 있는 다양한 Method가 포함되어 있다. 이러한 String Class는 'java.lang' 패키지에 포함되어서 제공이 된다. (String Class를 사용할 때는 import를 하지 않아도 선언하고 바로 사용할 수 있다.) String 인스턴스는 한 번 생성되면 값을 읽기만 하고 변경할 수는 없다. 이러한 객체를 자바에서 불변 객체(Immutable Object)라고 한다. 예를 들면, 자바에서 덧셈 연산으로 문자열을 결합하게 되면 기존 문자열의 내용이 변경되는 것이 아닌 내용이 합쳐진 새로운 String 인스턴스가 생성되는..