FileDocCategorySizeDatePackage
Flower.javaAPI DocExample3293Mon Apr 06 18:10:26 BST 1998None

Flower

public class Flower extends Object

Fields Summary
private int
petalCount
private String
s
Constructors Summary
Flower(int petals)

    
    petalCount = petals;
    System.out.println(
      "Constructor w/ int arg only, petalCount= "
      + petalCount);
  
Flower(String ss)

    System.out.println(
      "Constructor w/ String arg only, s=" + ss);
    s = ss;
  
Flower(String s, int petals)

    this(petals);
//!    this(s); // Can't call two!
    this.s = s; // Another use of "this"
    System.out.println("String & int args");
  
Flower()

    this("hi", 47);
    System.out.println(
      "default constructor (no args)");
  
Methods Summary
public static voidmain(java.lang.String[] args)

    Flower x = new Flower();
    x.print();
  
voidprint()

//!    this(11); // Not inside non-constructor!
    System.out.println(
      "petalCount = " + petalCount + " s = "+ s);