java 7の新しい特性の新しい文法1


いろいろな制限があるので、この節を二つの部分に分けて送ってください。読者は一つの種類の中に置いて見てもいいです。
public class NewFutureOverview<E> {
	private E e;
	
	/**
	 * --1--
	 *      
	 *    byte,short,int,long      2    
	 *       ,                 
	 */
	public static void testBinary(){
		//An 8-bit 'byte' value:
		byte c = (byte)0B0000_1111;//       byte c = (byte)0B00000001           
		System.out.println(c);
		// A 16-bit 'short' value:
		short aShort = (short)0b0010000101000101;
		// Some 32-bit 'int' values:
		int anInt1 = 0b10100001010001011010000101000101;
		// A 64-bit 'long' value. Note the "L" suffix:
		long aLong = 0b1010000101000101101000010100010110100001010001011010000101000101L;
		System.out.println(aShort+","+anInt1+","+aLong);
	}
	
	/**
	 * --2--
	 * switch     ,                  
	 */
	public static void testSwitch(){
		String type="apple";
		switch(type){
		case "apple":
			System.out.println("dear");
			break;
		case "amd":
			System.out.println("amd");
			break;
		case "lenovo":
			System.out.println("le");
			break;
		}
	}
	
	/**
	 * --3--
	 *  java7       
	 */
	public static void testGenericClass(){
		//1、java7              
		//java           
		// Java SE7           :                       ,
		//          ,    
		//          : nameList.addAll(new ArrayList<>());
		List<String> nameList = new ArrayList<>(16);
		nameList.add("Terry");
		
		//  java7            ,       
		//NewFutureOverview<Integer> newf = new NewFutureOverview<>("");
	}
	
	/**
	 *     
	 * @param t
	 */
	public <T> NewFutureOverview(T t){
		System.out.println(t.getClass().getName());
	}
	public E getE(){
		return e;
	}
	public void setE(E e){
		this.e = e;
	}
}