public:computer:java

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
public:computer:java [2022/04/04 17:38] alexpublic:computer:java [2022/09/15 23:06] alex
Line 1: Line 1:
 ====== Java ====== ====== 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 ====
 +<sxh java>
 +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();
 +      }
 +    }
 +  }
 +  
 +...
 +...
 +</sxh>
 +
 +  * conn.setAutoCommit(true/false);
 +  * conn.commit();
 +  * conn.rollback()
 +  * PreparedStatement stmt = conn.prepareStatement(".... ?");
 +    * stmt.setString(1, "value");
 +
 +  * DAO<sup>Data Access Object</sup>
 +  * DTO<sup>Data Transfer Object</sup>
 +  * JPA<sup>Java Persistence API</sup>
 +
 +
 +==== 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 <list-group>
 +  * byte
 +  * short
 +  * int
 +  * long
 +  * float
 +  * double
 +  * char
 +  * boolean
 +  * void
 +</list-group>
 +
 +  * class & packages <list-group>
 +  * class
 +  * interface
 +  * enum
 +  * package
 +  * import
 +  * extends
 +  * implements
 +  * this
 +  * super
 +  * new
 +</list-group>
 +
 +  * modifiers <list-group>
 +  * public
 +  * protected
 +  * private
 +  * static
 +  * final
 +  * abstract
 +  * native
 +  * volatile
 +  * transient
 +  * synchronized
 +  * strictfp
 +</list-group>
 +
 +  * operations <list-group>
 +  * if
 +  * else
 +  * switch
 +  * case
 +  * default
 +  * for
 +  * while
 +  * do
 +  * break
 +  * continue
 +  * return
 +  * instanceof
 +  * assert
 +</list-group>
 +
 +  * exceptions <list-group>
 +  * try
 +  * catch
 +  * finally
 +  * throw
 +  * throws
 +</list-group>
 +
 +  * others <list-group>
 +  * const
 +  * goto
 +</list-group>
  
 ===== References ===== ===== References =====
Line 10: Line 187:
   * [[https://java-design-patterns.com/principles/|Java Design Patterns]]   * [[https://java-design-patterns.com/principles/|Java Design Patterns]]
   * [[https://github.com/iluwatar/java-design-patterns|Design patterns implemented in Java]]   * [[https://github.com/iluwatar/java-design-patterns|Design patterns implemented in Java]]
 +  * [[https://github.com/lesstif/TIL/blob/master/JAVA/%EC%9E%90%EB%B0%94-%EC%BD%94%EB%93%9C%EB%A5%BC-%EC%A1%B0%EC%9E%91%ED%95%98%EB%8A%94-%EB%8B%A4%EC%96%91%ED%95%9C%EB%B0%A9%EB%B2%95.md|자바-코드를-조작하는-다양한방법.md]]
  • public/computer/java.txt
  • Last modified: 2022/09/15 23:21
  • by alex