123456789101112131415import java.io.BufferedReader;import java.io.InputStreamReader; public class Solution2047 { public void run() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine().toUpperCase(); System.out.println(input); } public static void main(String[] args) throws Exception { new Solution2047().run(); }} Colored by Col..
12345678910111213141516171819202122232425import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader; // 2050. 알파벳을 숫자로 변환public class Solution2050 { public void run() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); // StringBuilder() : 문자열을 더할 때 새로운 객체를 생성하지 않고 기존의 데이터 더하는 방식 cha..
1. 인터페이스(Interface)- 인터페이스는 클래스들이 그 기능을 서로 다르게 구현할 수 있도록 하는 클래스의 규격 선언- 클래스의 다형성을 실현하는 도구- 특징 1. 멤버는 추상 메서드와 상수만으로 구성 2. 모든 메서드는 abstract public이며 생략 가능 3. 상수는 public static final 타입이며 생략 가능 4. 인터페이스는 객체를 생성할 수 없음 5. 다른 인터페이스에 상속 가능 6. 인터페이스 타입의 레퍼런스 변수는 선언 가능 -- Teacher.java1234567891011121314public class Teacher { public void teach(ClassOne classone) { System.out.println("teach " + classone.ge..
1. 생성자-- Student.java1234567public class Student { String name; public void setName(String name) { this.name = name; }}Colored by Color Scriptercs -- Stu1.java123456public class Stu1 extends Student { // Student 클래스를 상속 public void say() { System.out.println("Hi I'm " + this.name); }} Colored by Color Scriptercs -- MasterStu.java-- 생성자는 클래스명과 메서드명이 동일-- 리턴타입을 정의하지 않음12345678910111213141516public..
1234567891011121314151617181920212223import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int T = scan.nextInt(); int lim[] = {31,28,31,30,31,30,31,31,30,31,30,31}; for(int i=0; i
1. 상속(inheritance)-- Student.java1234567public class Student { String name; public void setName(String name) { this.name = name; }}Colored by Color Scriptercs-- Stu1.java1234567891011121314package test; public class Stu1 extends Student { // Student 클래스를 상속 public void say() { System.out.println("Hi I'm " + this.name); } public static void main(String[] args) { Stu1 stu1 = new Stu1(); stu1.setNa..
1. 클래스(class)-- 클래스 생성1234567891011121314// 클래스 생성 public class Student { String name; // 객체 변수(인스턴스 멤버, 멤버 변수, 속성) public void setName(String name) { // 메소드(Method) this.name = name; } public static void main(String[] args) { Student stu1 = new Student(); // cat 객체 생성, student의 인스턴스(instance) stu1.setName("Aaron"); System.out.println(stu1.name); // 객체 변수의 값 확인 }}Colored by Color Scriptercs 2. 메..
1. if123456789if (조건문) { ...} else { ...}cs 12345678910111213if (조건문) { ...}else if (조건문) { ...} else { ... }cs 2. switch/case123456789switch(입력변수) { case 입력값1: ... break; case 입력값2: ... break; ... default: ... break;}cs 3. while12345678910while (조건문) { ... if (조건문) { continue; // 수행 문장3을 skip하고 while 조건문으로 } } Colored by Color Scriptercs 12345678while (true) { ... if (조건문) { break; // while문 빠져..