java有趣的代码

package org.java.funning;
/**
 * 作者: sunhouji
 * 时间: 2011-4-8 上午10:14:20
 */
public class FunnyTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		LongDivision();
		Multicast();
		DosEquis();
		System.out.println(test());
	}
	
	private static void LongDivision (){
		final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000;
		final long MILLIS_PER_DAY = 24 * 60 * 60 * 1000;
		System.out.println(MICROS_PER_DAY/MILLIS_PER_DAY);
		
	}
	
	private static void Multicast (){
		System.out.println((byte) -1);
		System.out.println((char)(byte) -1);
		System.out.println((int)(char)(byte) -1);
	}
	
	private static void DosEquis(){
		char x = 'X';
		int i = 0;
		System.out.println(true?x:0);
		System.out.println(true?x:65536);
		System.out.println(false?i:x);
	}

	private static boolean test(){
		try{
			return false;
		}finally {
			return true;
		}
	}
}

你可能感兴趣的:(java)