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

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)
File I/O - loading data and creating txt file from CSV file.

students.csv id,name 1,A 2,B 3,C public class StudentInfo { private int id; private String name; public StudentInfo(int id, String name){ this.id = id; this.name = name; } public int studentId(){ return id; } @Override public String toString(){ return "Student Id: " + this.id + ", " + "name: " + this.name + "\n"; } } public class Main { public static void main(String[] args) throws FileNotFoundE..

JAVA 2019. 7. 5. 05:16
Convert Array to ArrayList, ArrayList to Set

asList() is used to convert Array to List. This example takes an Integer type array as a parameter and it needs to remove duplicate numbers as a result. But, when you use asList(), the type of array should be Object type wrappers. Because Generics only works for a reference type. List 는 Generic 이기에 오직 reference type만을 전달 받는다. 그래서 asList()에 primitive 타입이 올 수 없게 된다. Example Code import java.util.*..

JAVA 2019. 7. 1. 14:10
enum in Java

enum 열거형 - enum은 연관된 상수들의 집합(a set of named constants.)으로 열거 순서에 따라 index번호를 부여받는다. - enum은 private constructor가 default이기에 public생성자의 생성이 금지된다 인스턴스를 만들 수 없다는 것은 즉, 다른 용도의 사용을 금한다는 의미이다. Example Code enum Fruit{ APPLE, PEACH, BANANA; Fruit(){ System.out.println("Constructor"); } } public class Main { public static void main(String[] args) { Fruit type = Fruit.APPLE; switch(type){ case APPLE: Sys..

JAVA 2019. 6. 24. 05:46
Exception handling in Java

예외처리 (Exception handling) 은 프로그램의 논리에 벗어난 에러인 runtime error를 발견하도록 도와준다. - 사용자정의 exception handling 이 아닌 자바에 자체적으로 내장되어있는 에러클래스의 경우 (e.g. ArithmeticException) 사용자가 새롭게 객체를 정의하지 않아도 JVM에 의해 생성된 인스턴스의 참조값이 전달된다. import java.util.Scanner; class Main{ public static void main(String[] args){ System.out.print("Enter two digits: "); Scanner keyboard = new Scanner(System.in); int num1 = keyboard.nextInt..

JAVA 2019. 6. 24. 03:27
Object type casting(upcasting,downcasting) example in Java

Upcasting을 이용하면 부모객체로 부터 상속받은 메서드를 사용할 수 있게된다. 즉, 단 하나의 부모클래스의 객체(PhoneInfo)로 여러가지 자식 메서드(univPhoneInfo, companyPhoneInfo, friendPhoneInfo)를 검색할 수 있는 장점이 있다. Example I public class PhoneInfo { String name; String phoneNum; public PhoneInfo(String name, String num){ this.name = name; phoneNum = num; } public void showInfo(){ System.out.println("name: " + name); System.out.println("phone: " + phon..

JAVA 2019. 6. 17. 08:06
StringBuffer in Java

StringBuffer StringBuffer class is rewritable, unlike String class which is not allowed to change itself once it is declared. String is immutable. Methods of StringBuffer class 1. append123StringBuffer sb = new StringBuffer("Hello "); sb.append("StringBuffer"); // add new stringSystem.out.println(sb);//prints Hello StringBuffer cs 2. insert123StringBuffer sb = new StringBuffer("Hello "); sb.inse..

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

티스토리툴바