This is an old revision of the document!
Java
String
→StringBuilder
java.util.Date
↔java.time.Instant
java.util.Calendar
→java.time.Instant
java.text.SimpleDateFormat
java.time
- Local
- Zoned
- Offset
- Collections
- List; ArrayList, LinkedList
- Set; HashSet, LinkedHashSet
- Map; HashMap, LinkedHashMap
- 람다식
(자료형 인수, ...) -> { ... 임의의 처리 ...}
Database
import java.sql.*; ... ... Connection conn = null; try { Class.forName("DRIVER"); } catch(ClassNotFoundException e) { e.printStackTrace(); } try { conn = DriverManager.getConnection("jdbc database", "user", "password"); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery("QUERY"); while(rset.next()) { // do something } } catch(SQLException e) { e.printStackTrace(); } finally { if(conn != null) { try { conn.close(); conn = null; } catch(SQLException e) { e.printStackTrace(); } } } ... ...
- conn.setAutoCommit(true/false);
- conn.commit();
- conn.rollback()
- PreparedStatement stmt = conn.prepareStatement(“…. ?”);
- stmt.setString(1, “value”);
- DAOData Access Object
- DTOData Transfer Object
- JPAJava Persistence API
File I/O
- FileReader
- BufferedReader
- Scanner
- Files
- CSV, XML, LOGGER
Tests
- JUint
- @Test
- @Before
- @After
- @BeforeClass
- @AfterClass
- @Ignore
- import static org.junit.Assert.*;
- assertEquals()
- fail()
- assertThat()
- import static org.hamcrest.CoreMatchers.*;
- is()
- JMockit
- DbUnit
Reserved Words
- data types
- class & packages
- modifiers
- operations
- exceptions
- others