public:computer:java

This is an old revision of the document!


Java

  • StringStringBuilder
  • java.util.Datejava.time.Instant
  • java.util.Calendarjava.time.Instant
  • java.text.SimpleDateFormat
  • java.time
    • Local
    • Zoned
    • Offset
  • Collections
    • List; ArrayList, LinkedList
    • Set; HashSet, LinkedHashSet
    • Map; HashMap, LinkedHashMap
  • 람다식
(자료형 인수, ...) -> { ... 임의의 처리 ...}

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
  • FileReader
  • BufferedReader
  • Scanner
  • Files
  • CSV, XML, LOGGER
  • JUint
    • @Test
    • @Before
    • @After
    • @BeforeClass
    • @AfterClass
    • @Ignore
    • import static org.junit.Assert.*;
      • assertEquals()
      • fail()
      • assertThat()
      • import static org.hamcrest.CoreMatchers.*;
        • is()
  • JMockit
  • DbUnit
  • data types
    • byte
    • short
    • int
    • long
    • float
    • double
    • char
    • boolean
    • void
  • class & packages
    • class
    • interface
    • enum
    • package
    • import
    • extends
    • implements
    • this
    • super
    • new
  • modifiers
    • public
    • protected
    • private
    • static
    • final
    • abstract
    • native
    • volatile
    • transient
    • synchronized
    • strictfp
  • operations
    • if
    • else
    • switch
    • case
    • default
    • for
    • while
    • do
    • break
    • continue
    • return
    • instanceof
    • assert
  • exceptions
    • try
    • catch
    • finally
    • throw
    • throws
  • others
    • const
    • goto
  • public/computer/java.1663250769.txt.gz
  • Last modified: 2022/09/15 23:06
  • by alex