Learn JAVA5 Tiger from sample codes: avargs

public   class  Artist   {
    
    String[] others;
     /** */ /**  Creates a new instance of Artist  */ 
      public  Artist()   {
    } 
      public  Artist(String name,String ... others)  {
         for (String other : others)  {
            System.out.println(other);
        } 
         this .others  =  others;
    } 
      public   void  wildestMethod(Object ... objs)  {
     // this method will accept any arguments 
     } 
      public   static   void  main(String[] args)  {
        Artist artist  =   new  Artist( " You " ,  " 1 " ,  " 2 " );
        artist.wildestMethod( 1 ,  3.5 ,  " AA " ,  new  Artist());
    } 
    
}


(0) 评论    (0) 引用   

Learn JAVA5 Tiger from sample codes: Auto Boxing and Unboxing

public class AutoBoxing {
    
    /** Creates a new instance of AutoBoxing */
    public AutoBoxing() {
    }
    public void boxingDemo(){
        //auto boxing
        Integer i = 0;
        float f = 1.66f;
        Float F = f;
        //auto unboxing
        Integer I = new Integer(1);
        int i2 = I;
        //null value test, it will case NullPointerException
        Integer I2 = null;
        int i3 = I2;
    }
    public void testOperator(){
        Integer i = 1;
        while(true){
            i++;
            System.out.println("Counter:"+i);
            if(i>5) break;
        }
    }
    public void testCompare(){
        //it's equal because -127~127 are immutable objects
        Integer i = 1;
        Integer i2 = 1;
        if(i == i2) System.out.println("1:Equal");
        else System.out.println("1:Not Equal");
        //it's not equal because j and j2 are different objects
        Integer j = 200;
        Integer j2 =200;
        if(j == j2) System.out.println("200:Equal");
        else System.out.println("200:Not Equal");
    }
    public void testControl(){
        Boolean flag = true;
        Integer i = 20;
        Integer j = 30;
        if(flag){
            System.out.println("Boolean affects");
        }
        if(i<j)
            System.out.println("Integer affects");
    }
    public void testMethod(double arg){
        System.out.println("public void testMethod(double arg) is invoked");
    }
    public void testMethod(Integer arg){
        System.out.println("public void testMethod2(Integer arg) is invoked");
    }
    public static void main(String args[]){
        AutoBoxing auto = new AutoBoxing();
        auto.testCompare();
        auto.testOperator();
        auto.testControl();
        int i = 1;
        // public void testMethod(Integer arg) wouldn't be invoked
        //because  public void testMethod(double arg) will be invoked in JDK1.4
        //Java tiger consider the backward capability
        auto.testMethod(i);
        auto.boxingDemo();
    }
    
}


(0) 评论    (0) 引用   

Learn JAVA5 Tiger from sample codes: Enumerated

public enum User {
    Admin,User,Guest,Unknown   
}

public class Login {
    
    private User user;
    EnumMap<User,String> userName = new EnumMap<User, String>(User.class);
    /** Creates a new instance of Login */
    public Login() {
        userName.put(User.Admin, "Administrator");
        userName.put(User.User, "David");
        userName.put(User.Guest, "Steve");
    }
    public boolean isAdmin(User user){
        if(user.equals(User.Admin)){
            return true;
        }
        return false;
    }
    public void printUserRole(){
        User[] users = user.values();
        for(User u : user.values()){
            System.out.println(u.toString());
        }
    }
    public void isRole(User user){
        switch(user){
            case Admin:
                System.out.println("admin");
                break;
            case User:
                System.out.println("User");
                break;
            case Guest:
                System.out.println("Guest");
                break;
            default:
                System.out.println("unknow");
        }
    }
    public static void main(String[] args){
        Login login = new Login();
        System.out.println(login.isAdmin(User.Admin));
        login.printUserRole();
        login.isRole(User.User);
    }
    
}


(0) 评论    (0) 引用   

Learn JAVA5 Tiger from sample codes: Generic

/**
 * public class Box<T extends Number>
 * @author david.duan
 */
public class Box<T> {
    
    //you can't have a static variable such as protected static List<T> list...
    protected List<T> contents;
    
    public Box( ) {
        contents = new ArrayList<T>( );
    }
    public int getSize( ) {
        return contents.size( );
    }
    public boolean isEmpty( ) {
        return (contents.size( ) == 0);
    }
    public void add(T o) {
        contents.add(o);
    }
    public T grab( ) {
        if (!isEmpty( )) {
            return contents.remove(0);
        } else
            return null;
    }
    public static void main(String[] args){
        Box<String> box = new Box<String>();
        //...
    }
}


public class Generic {
    
    /** Creates a new instance of Generic */
    public Generic() {
    }
    
    public void collectionGeneric(){
        //generic list
        List<String> onlyStrings = new LinkedList<String>();
        onlyStrings.add("Legal addition");
        //generic map
        Map<Integer, Integer> squares = new HashMap<Integer, Integer>();
        for (int i=0; i<100; i++) {
            squares.put(i, i*i);
        }
        for (int i=0; i<10; i++) {
            int n = i*3;
            System.out.println("The square of " + n + " is " + squares.get(n));
        }
        //generic iterator
        List<String> listOfStrings = new LinkedList<String>();
        listOfStrings.add("Happy");
        listOfStrings.add("Birthday");
        for (Iterator<String> i = listOfStrings.iterator(); i.hasNext( ); ) {
            String s = i.next( );
            System.out.println(s);
        }
    }
    //parameter generic
    public void paramGeneric(List<String> list){
        for(Iterator<String> i = list.iterator();i.hasNext();){
            String s = i.next();
            System.out.println(s);
        }
    }
    //return generic
    public List<String> returnGeneric(){
        List<String> list = new LinkedList<String>();
        list.add("string1");
        return list;
    }
    //conversion
    public void conversionGeneric(){
        LinkedList<Float> floatList = new LinkedList<Float>();
        List<Float> moreFloats = floatList;
        //illegal conversion LinkedList<Number> numberList = floatList;
        //the way to resolve for backward capbility
        List<Integer> ints = new LinkedList<Integer>();
        List oldList = ints;
        List<Number> numList = oldList;
    }
    //generic wildcard : this old plain way will generate unchecked warning
    public void wildcardGeneric(List list){
        for (Iterator i = list.iterator(); i.hasNext(); ) {
            System.out.println(i.next().toString());
        }
    }
    //generic wildcard
    public void wildcardGeneric2(List<?> list){
        //you can't solve the problem by List<Object>
        for (Iterator<?> i = list.iterator( ); i.hasNext(); ) {
            System.out.println(i.next().toString( ));
        }
    }
    
}


(0) 评论    (0) 引用   

JAVA5 Tiger sample codes:

 int[][] ar = {{1,2,3},{4,5,6}};
        int[][] br = {{1,2,3},{4,5,6}};
        System.out.println(Arrays.deepToString(ar));
        System.out.println(Arrays.deepEquals(ar,br));
        StringBuilder sb = new StringBuilder("string builder");


(0) 评论    (0) 引用   

ABAP learning map

download it and enjot it.

(0) 评论    (96) 引用   

SAP new UI

A couple of weeks ago in Sapphire Orlando, SAP introduced the world to a new user interface, code-named Project Muse. I thought I'd give the SDN'ers a quick overview of what it is. Basically, Muse is a new interface thru which SAP users can access any SAP application directly from their Macintosh, Linux or Windows client device, and in the future from integrated mobile devices.

Project Muse is being built from the ground up as an open, standards-based architecture-- using Flash and Flex technologies from Adobe/Macromedia. Project Muse can be easily extended to deliver applications, composites and any other service-enabled software from SAP and its partners or from other solution providers (think: ubiquitous business user interface for all your enterprise systems). The new client adds the richness of desktop software to the deployment efficiency of Internet software, delivering on SAP's vision of simplifying the user experience and the software ownership experience.

I've created a short (8 minutes) demo of Project Muse so you can get a good sense of what it's capable of. There's also a fact sheet that was distributed at the Sapphire launch.
More infor plz check here https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3748
And we should pay attention on Apollo this framework.


(0) 评论    (190) 引用