본문 바로가기

JAVA28

230111_Stream package day28_TotalStream; import java.text.DecimalFormat; public class DTO { DecimalFormat df = new DecimalFormat("#,##0.0"); int ban,number; String name; int kor,eng,mat; int tot; double avg; String hak; public DTO() {} public DTO(int ban, int number, String name, int kor, int eng, int mat, int tot, double avg, String hak) { super(); this.ban = ban; this.number = number; this.name = name; this.. 2023. 1. 11.
230110_Stream 스트림(Stream) = 또 다른 처리방식의 하나 객체명.stream().중간함수.중간함수.최종함수 중간함수 값을 불러오는 mapToInt : 정수를 불러옴 mapToDouble : 실수를 불러옴 조건설정(if~) filter. 정열 (sorted).Compartor... package day27_1; public class DTO { String spname; int su; int dan; int price; public DTO() {} public DTO(String spname, int su, int dan, int price) { super(); this.spname = spname; this.su = su; this.dan = dan; this.price = price; } public Stri.. 2023. 1. 10.
230109_Stream Stream : 자료를 표현하는 또는 값을 구하는 또다른 방식의 하나이다. stream으로 값을 구하는 방식은 여러가지이나 객체를 통해서 값을 얻거나 출력하는 것이 가장 쉬운 방법 중 하나이다. stream 사용법 =객체명.stream().중간함수() ...... 최종함수(). 중간함수 : 여러번 사용가능 maptoInt(클래스명 :: 게터함수()) 중간함수 1.값을 불러올때 mapTo~ 2. filter(.. 조건 ..) 3. sorted(정열).. package day26; import java.text.DecimalFormat; public class DTO { DecimalFormat df = new DecimalFormat("#,##0.0"); int ban; String name; int ko.. 2023. 1. 9.
230106_Map package day25; import java.text.ChoiceFormat; public class ArrayTest { public static void main(String[] args) { String [] name = {"한라산","백두산","금강산","설악산","내장산","명지산","광교산"}; int [] jum = {80,66,92,71,85,59,100}; String [] hak = {"F","D","C","B","A"}; double [] avg = {0,60,70,80,90}; // 반드시 오름차순 정열 // 학점구하기 ChoiceFormat cf = new ChoiceFormat(avg,hak); // 출력하기 for(int i=0;iSystem.out.println(s.toS.. 2023. 1. 6.
230105_Map package day24_MapTest; import java.util.Iterator; import java.util.Scanner; import java.util.Set; import java.util.TreeMap; public class MapTest1 { public static void main(String[] args) { TreeMap map = new TreeMap(); map.put(1, "일요일"); map.put(2, "월요일"); map.put(3, "화요일"); map.put(4, "수요일"); map.put(5, "목요일"); map.put(6, "금요일"); map.put(7, "토요일"); Set kset = map.keySet(); //키값들의 모임 //Iterator i.. 2023. 1. 5.
230104_Map Map ->키,값 한쌍으로 Map 구조는 반드시 키값을 알아야 값을 출력 package day23_CollectionTest; import java.util.ArrayList; import java.util.Iterator; class MyinfoDTO { String name; int age; String address; public MyinfoDTO() {} public MyinfoDTO(String name, int age, String address) { super(); this.name = name; this.age = age; this.address = address; } @Override public String toString() { return "MyinfoDTO [name=" + nam.. 2023. 1. 4.