본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

JAVA (58)
Java is Pass-By-Value

Primitive types swap method will never work because Java is strictly Pass-By-Value. If you want to swap two arguments, use array or object to send reference as a value. Example I primitive types are never changed class Main { //primitive type doesn't swap public static void swap(int i, int j) { int temp = i; i = j; j = temp; } public static void main(String[] args) { int i = 10; int j = 20; swap..

JAVA 2019. 7. 27. 06:08
Arrays.sort in Java

Array.sort() sort the Array in ascending order Example Code import java.util.Arrays; public class Main { public static void main(String[] args) { int arr[] = {2,7,1,9,7}; for (int number : arr) { System.out.print(number); //27197 } // sorting array Arrays.sort(arr); System.out.println("\nSorted numbers are"); for (int number : arr) { System.out.print(number); //12779 } } }

JAVA 2019. 7. 23. 09:34
Collection framework - HashMap

HashMap HashMap is not thread-safe which allows you faster speed than HashTable. HashMap doesn't allow insertion order. *Use LinkedHashMap to preserve the fixed order. key doesn't allow duplicate key, but for value, duplication is allowed. put() - key, value map에 입력 get() - key를 전달해야 그 key의 value가 반환된다. remove() - 해당 key의 key와 value 삭제 Example Code import java.util.*; public class Main { public ..

JAVA 2019. 7. 23. 07:18
keySet() in Java

keySet() returns a set of the keys in HashTable. Example Code I import java.util.*; public class Main { public static void main(String[] args) { Map hash = new HashMap(); String[] fruit = {"apple", "banana", "cherry"}; for (int i = 0; i

JAVA 2019. 7. 23. 06:54
Map - getOrDefault(), putIfAbsent() in Java

Map - getOrDefault(key, Default-value) If the key is already mapped with a specified value, return the value, or return the default value if no value is associated with any key. 특정 key가 특정 value와 map 되어있다면 해당 value를 리턴하고 map이 안되어 있을 경우 default value를 리턴한다. Example code import java.util.*; public class Main { public static void main(String[] args) { String[] fruit = {"apple", "banana", "apple", "..

JAVA 2019. 7. 23. 06:12
Java IOException - Stream Closed

file.close() should be outside of while loop otherwise java.io.EOFException occur. You should place close() in finally. public void readFile() throws ClassNotFoundException { if (!dataFile.exists()) //생성한 파일이 존재하지 않으면 return return; ObjectInputStream in = null; //try 구문 바깥에 선언해줘서 다른 scope 에서도 사용가능하게 해준다! try { BufferedInputStream fileIn = new BufferedInputStream (new FileInputStream(dataFile)); ..

JAVA 2019. 7. 19. 08:27
이전 1 2 3 4 5 ··· 10 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • 프로그래머스
  • hackerrank javascript
  • Javascript Algorithm
  • hackerrank javascript solution
  • hackerrank
  • math.abs
  • C++
  • easy algorithm
  • equals()
  • Collection Framework
  • string class in java
  • HackerRank Algorithm
  • 프로그래머스 알고리즘문제
  • 프로그래머스 알고리즘
  • compareTo()
  • 알고리즘
  • Object type casting
  • ... in Javascript
  • java
  • easy javascript algorithm
  • spring boot application
  • repeat()
  • substring()
  • code refactoring
  • javascript
  • rest parameter
  • HashMap
  • math.max
  • hackerrank solution
  • algorithm
more
«   2025/10   »
일 월 화 수 목 금 토
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 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바