국비/스터디2 스터디2_연습문제 스터디 : 09.12 11:00 ~17:00, 주어진 문제 풀어보고 풀이 비교 1. 정수를 몇 개 저장할지 키보드로부터 개수를 입력받아(100보다 작은 개수로 제한한다.) 정수 배열을 생 성하고, 이곳에 1에서 100까지 범위의 정수를 랜덤하게 삽입하시오. 같은 값은 생성하지 못하도록 설정하 고 생성된 배열을 출력하시오. import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class ex05 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Set unit = new HashSet(); System.out.print("배.. 2021. 9. 12. 스터디1_인터페이스 설계도 * 2021.09.04 자바의 정석 ex7_26 설계도 그려보기 * 2021.09.05 피드백 자바의 정석 ex7_26 public static void main(String[] args) { Tank tank = new Tank(); Dropship dropship = new Dropship(); Marine marine = new Marine(); SCV scv = new SCV(); scv.repair(tank); scv.repair(dropship); } } interface Repairable{} class Unit{ int hitPoint; final int MAX_HP; Unit(int hp){ MAX_HP = hp; } } class GroundUnit extends Unit{ Ground.. 2021. 9. 5. 이전 1 다음