
백준 문제를 풀다가 % 를 함께 출력해야 하는 문제를 만났다. -> https://www.acmicpc.net/problem/4344 package array; import java.util.*; public class Baekjoon_4344 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++){ int student = sc.nextInt(); int[] score = new int[student]; for (int j = 0; j < student; j++){ score[j] = sc.nextInt(); } double a..

클래스와 객체 class Animal { } // 보통 자바에서는 따로 파일을 만들지만 가독성상 한 파일에 쓰겠음 public class Sample { public static void main(String[] args) { Animal cat = new Animal(); } } Animal class 는 가장 간단한 클래스 형태 껍데기 뿐일지라도 객체를 만드는 기능! 객체는 다음과 같이 만든다. class Animal { } public class Sample { public static void main(String[] args) { Animal cat = new Animal(); // 여기! } } new는 객체를 생성할 때 사용하는 키워드 cat 은 Animal 클래스의 인스턴스 이면서 하나의 ..