| Framework | Memo |
|---|---|
| Apache Struts | http://struts.apache.org/ |
| Spring Framework | http://www.springsource.org/ |
| JSF | |
| log4j | http://logging.apache.org/ |
public class Sample {
}
public class Sample {
public static void main( String[] args ) {
//
}
}
System.out.println( "Hello world" );
//aaaa /* aaaaaaa bbbbbb */ /** JavaDoc */
int num; int num; char c; float value; double value; boolean flag; String s; Date d; String[] array;
int i = 2; int i = 100000000; float num = 1.234f; double num = 1.234;
num = 1 + 1; num = 1 - 1; num = 1 * 2; num = 1 / 2; num = 1 / 2; // 0 num = 1.0 / 2; // 0.5 num = 1 / 2.0; // 0.5 num = 1.0 / 2.0; // 0.5
String str = "abc"; String join = "aaa" + "bbb"; String[] record = "aaa,bbb,ccc".split( "," ); int length = "abcdef".length(); "abcd".substring( 0, 2 ) // abc int result = "abcd".indexOf( "cd" )
int[] array;
int [] array;
array = new int[5];
array = new int[] { 1, 2, 3 };
int[] array2 = new int[5];
array[0] array[1] array[0] = 1; array[1] = 2;
if ( condition ) {
}
if ( condition ) {
} else {
}
if ( condition ) {
} else if ( condition ) {
}
int i = 0;
while ( i < 5 ) {
//
++i;
}
for ( int i = 0; i < 5; ++i ) {
}
int[] fields = new int[] { 1, 2, 3 };
for ( int field: fields ) {
}
static int sum( int num1, int num2 ) {
int total;
total = num1 + num2;
return total;
}
import java.io.*;
BufferedReader reader = null;
try {
reader = new BufferedReader( new FileReader( filename ) );
String line;
while ( ( line = reader.readLine() ) != null ) {
}
} catch ( IOException e ) {
//
} finally {
if ( reader != null ) {
try {
reader.close();
} catch ( IOException e ) {}s
}
}
PrintWriter writer = null;
try {
writer = new PrintWriter( new BufferedWriter( new FileWriter( filename ) ) );
writer.println( "abc" );
writer.println( "def" );
writer.println( "fgh" );
} catch ( IOException e ) {
//
} finally {
if ( writer != null ) {
writer.close();
}
}