alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
/*
 * Signature1User3.java
 *
 * Created on January 15, 2004, 10:56 AM
 */

package org.netbeans.test.signature;

import java.util.Arrays;
import java.util.List;

/**
 *
 * @author  Pavel Flaska
 */
public class Signature1User3 {

    static final String[] names = new String[] {
        "Katerina",
        "Katherine",
        "Cathleen",
        "Kathryn",
        "Katharina",
        "Caterina",
        "Catalina"
    };
    
    static final List l = Arrays.asList(names);
    
    // Method usage in constructor test
    public Signature1User3() {
        
    }

    // Method usage in inner class
    static class InnerClass {
        public String callCatalina() {
            Signature1Owner ow = new Signature1Owner();
            Object catalina = null;
            if (Math.random() > 0.2) {
                // in par
                return new StringBuffer(ow.signatureMethod(l, catalina, 7)).toString();
            }
            else {
                // in if
                if (ow.signatureMethod(l, catalina, 3).equals("Kathryn")) {
                    return "Winner is Kathryn!";
                }
                else {
                    Object anybody = null;
                    String s = ow.signatureMethod(l, anybody, 0);
                    for (int i = 0; s.charAt(0) != 'C'; s = ow.signatureMethod(l, anybody, i)) {
                        i++;
                    }
                    return "Winner is " + s + ".";
                }
            }
        }
    }
    
    // Method usage in anonymous class
    public void anon() {
        Object ann = new Object() {
            Object language = null;
            public String caller() {
                String s = new Signature1Owner().signatureMethod(l, language, 3);
                return s;
            }
        };
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.