Java Reference
In-Depth Information
Console 's package-private constructor saves its argument, which most likely will
be null becausethereisnoneedfora String argument.Perhapsafutureversionof
Console will use this argument to identify one of multiple console windows.
Listing 3-20 presents the package-private File class.
Listing 3-20. Logging messages to a file (eventually)
package logging;
class File implements Logger
{
private String dstName;
File(String dstName)
{
this.dstName = dstName;
}
@Override
public boolean connect()
{
if (dstName == null)
return false;
System.out.println("opening file "+dstName);
return true;
}
@Override
public boolean disconnect()
{
if (dstName == null)
return false;
System.out.println("closing file "+dstName);
return true;
}
@Override
public boolean log(String msg)
{
if (dstName == null)
return false;
Search WWH ::




Custom Search