Collections
Always assign size to ArrayLists and other collections. Ex:
Collection c = new ArrayList(10);
Strings
Always use
String abc = "I love Java";instead of
String abc = new String("I love Java");
JDBC
Always close these statements after use:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("databaseUrl","username","password");
Statement stmt = conn.createStatement();
String strSql = "select * from abc";
ResultSet rs = stmt.executeQuery("strSql");// close these
stmt.close();
rs.close();
conn.close();
strSql=null;
Use only the required columns in select query:
Select FIRSTNAME,LASTNAME from PERSON;
instead of
Select * from Person;
JSP
Use session object as compared to hidden values, url rewriting and cookies
Use
System.out.print()instead of
System.out.println();wherever necessary








0 comments:
Post a Comment