1、循环接受键盘输入,并可以退出
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
while ( true ) {
String line = in.readLine();
if ( "bye".equals( line ) )break;
}
2、打印调用栈
static void printStackTrack() {
StackTraceElement[] traces = Thread.currentThread().getStackTrace();
if ( null == traces || 0 == traces.length ){
return;
}
for ( StackTraceElement trace : traces ) {
if ( null == trace )
continue;
System.out.println("class="+trace.getClassName()+","+ trace.getMethodName()+",line="+trace.getLineNumber() );
}
}
3、打印java属性
System.getProperties().list(System.out);
4、定位AWT-Swing-UI
.setBorder(BorderFactory.createLineBorder(Color.RED));
弹出对话框:
JOptionPane.showMessageDialog( null, "msg","title", JOptionPane.OK_OPTION,IconURL );