www.pudn.com > ThinkinginJava4thEdition(SourceCode).zip > IceCream.java


//: access/IceCream.java 
// Demonstrates "private" keyword. 
 
class Sundae { 
  private Sundae() {} 
  static Sundae makeASundae() { 
    return new Sundae(); 
  } 
} 
 
public class IceCream { 
  public static void main(String[] args) { 
    //! Sundae x = new Sundae(); 
    Sundae x = Sundae.makeASundae(); 
  } 
} ///:~