Error: could not find or load main class Main 이란 처음 보는 에러 발생 첫번째 삽질 Invalidate Caches / Restart 두번째 삽질 Edit Configurations... ... 그리고 이 외의 숱한 삽질 끝에 폴더 이름에 special character 인 '/'를 넣어서 안됐던 것,,, File I/O 라 생각없이 넣었던 것이 결국, 엄청난 시간낭비로,, 그래도 알아내서 다행 IntelliJ won't allow you to use the special character in the file path. Reference https://stackoverflow.com/questions/10654120/error-could-not-find-or-loa..
Reading and Writing Java Object to a file in java //Serialization 직렬화 - Object 자체를 file 에 저장하고 싶을 때 사용. 이 클래스를 상속하는 하위클래스들도 직렬화가 가능해진다. public class PhoneInfo implements Serializable { ... } public class PhoneManager { private final File dataFile = new File("PhoneBook.txt"); //create file ... public void storeFile(){ FileOutputStream file = null; try { file = new FileOutputStream(dataFile); try ..
for-each for (Type obj : Collection) {...} example for (CustomInfo c : customManagers) { System.out.println(c.toString()); } works only if the collection holds elements of type Type. public class Main{ public static void main(String[] args) { int[] arr = new int[]{ 1,2,3,4,5 }; //for-each. normally used for iterating Arrays or Collection for (int i : arr) { System.out.print(i); //12345 } System...
returning ArrayList from method Option 1 - Wrong //weight을 계산 그러나 과목별,학생별은 상관이 없는 상태. private MarkInfo getWeight() { int t_id = 0; int s_id = 0; double weight = 0; for (MarkInfo m : markInfos) { for (TestInfo t : testInfos) { if (t.getTestId() == m.getMarkId()) { t_id = m.getMarkId(); s_id = m.getMarkStudentId(); weight = m.getMark() * (t.getWeight() / 100); } } } return new MarkInfo(t_id, s_id,..
Collection framework 에는 ArrayList처럼 순차적으로 data를 저장시키는 컬렉션이 있는 반면, hashSet과 같이 데이터의 순서가 무시되는 컬렉션도 존재하기에 element를 알아내기 위해서는 Iterator method를 사용해야한다. hasNext() - return true. if there is element left inside the iteration next() - return next element previous() - return the previous element remove() - remove next element Example code Iterator itr = phoneInfo.iterator(); //iterate phoneInfo while (it..
hasNextInt() Use hasNextInt() to check if it's integer or not while (!keyboard.hasNextInt()) { MenuViewer.keyboard.next(); //discard System.out.println("You entered character. Please, Enter a number to choose"); } Example Code while (true) { //try catch 구문이 while안에 있어야 에러처리가 끝나도 다시 메뉴를 선택할 수 있어. try { MenuViewer.menuViewer(); //Static method 이기 때문에 class name으로 호출 while (!MenuViewer.keyboard.has..
- Total
- Today
- Yesterday
- Collection Framework
- 프로그래머스
- rest parameter
- math.abs
- hackerrank solution
- string class in java
- C++
- java
- hackerrank javascript
- 프로그래머스 알고리즘
- easy javascript algorithm
- repeat()
- algorithm
- spring boot application
- equals()
- easy algorithm
- math.max
- substring()
- javascript
- compareTo()
- ... in Javascript
- HackerRank Algorithm
- Object type casting
- hackerrank
- 알고리즘
- hackerrank javascript solution
- 프로그래머스 알고리즘문제
- Javascript Algorithm
- HashMap
- code refactoring
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |