⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 103.html

📁 java编程思想
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><!-- This file edited for Java Jumpstart CD --> <HEAD><META VALUE="keyword" CONTENTS="codesamples"> <TITLE> Code Samples from the Java Developers Almanac 2000 </TITLE>   <META NAME="AUTHOR" CONTENT="Author's Name Goes Here">   <META NAME="DESCRIPTION" CONTENT="Description Goes Here">   <META NAME="KEYWORDS" CONTENT="Keyword Listing Goes Here">   <META NAME="OWNER" CONTENT="Editorial/JDC">   <META NAME="revision" CONTENT="@(#)index2.src 1.2 06/09/99  JDC">      <STYLE TYPE="text/css">     <!--      CODE {font-family: Courier, Monospace;           font-size: 12pt}     PRE {font-family: Courier, Monospace;          font-size: 11pt}       -->   </STYLE> </HEAD>  <!-- Start Body Insert--><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" ALINK="#FF0000" VLINK="#660066"><!-- End Body Insert--> <!-- Start PageTop Insert --><TD>    <P>    <TABLE BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0">      <TR VALIGN="TOP">        <TD WIDTH="100%"><IMG SRC="../../../../images/chiclet.row.gif" WIDTH="55"           HEIGHT="18" ALT=""></TD>                  <TD ROWSPAN="4" ALIGN="RIGHT" WIDTH="152"><IMG SRC="../../../../images/developer.connection.header.gif"BORDER="0" HEIGHT="42" WIDTH="319"></TD>      </TR>            <TR VALIGN="TOP">        <TD BGCOLOR="#FFFFFF" HEIGHT="1" WIDTH="100%">        <IMG SRC="../../../../images/pixel.gif" HEIGHT="1" WIDTH="1" ALT=""></TD>      </TR>            <TR VALIGN="TOP">        <TD BGCOLOR="#CC9966" HEIGHT="1" WIDTH="100%">        <IMG SRC="../../../../images/pixel.gif" HEIGHT="1" WIDTH="1" ALT=""></TD>      </TR>            <TR VALIGN="TOP"><TD><IMG SRC="../../../../images/codesamples.gif" WIDTH="165" HEIGHT="22" ALT="Code Samples" BORDER=0></TD>      </TR>    </TABLE>    </TD>  </TR></TABLE><!-- End PageTop Insert -->  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR> <TD> <FONT FACE="Verdana, Arial, Helvetica, sans-serif">  <!-- Template Version 2.0 -->  <!-- ================== --> <!-- Start Main Content --> <!-- ================== -->  <DIV ALIGN="RIGHT"> <FONT SIZE="3"><B>java.lang.ref</B></FONT><BR> <FONT SIZE="-1"><A HREF="../index.html">Code Samples Index</A></FONT> </DIV>  <P> <FONT SIZE="-1"> These code examples and other materials are subject to Sun  Microsystems, Inc.   <a href="../../../../share/text/SMICopyright.html">Legal Terms</a> </FONT>  <P> <H3>Determining When an Object Is About to be Reclaimed</H3>  A phantom reference is used to determine when an object is just about to be reclaimed. Phantom references are safer to use than finalization because once an object is phantom reachable, it cannot be resurrected.  <PRE> // Create the phantom reference. ReferenceQueue rq = new ReferenceQueue(); PhantomReference pr = new PhantomReference(<font color=#0066ff><I>object</I></font>, rq);      // Wait until the object is about to be reclaimed. try {   while (true) {   Reference r = rq.remove();   if (r == pr) {     // The object is about to be reclaimed.     // Clear the referent so that it can be reclaimed.     r.clear();   }   }   } catch (InterruptedException e) { } </PRE>  <P> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR><TD VALIGN=MIDDLE>  <FONT SIZE="-1" FACE="Verdana, Arial, Helvetica, sans-serif"> Examplets<SUP><FONT SIZE="-2">TM</FONT></SUP> &nbsp;are Copyrighted 2000 by Addison-Wesley and Patrick Chan <BR>and are provided as a courtesy for your educational, non-commercial use.<BR><BR> Order this book from <a href="http://www.amazon.com/exec/obidos/ASIN/0201432994/xeo">Amazon</a> </FONT>  </TD></TR></TABLE>     <!-- ================ --> <!-- End Main Content --> <!-- ================ -->  </FONT> </TD> </TR> </TABLE>  <!-- Copyright Insert --><TABLE WIDTH="100%" CELLPADDING="0" BORDER="0"	    CELLSPACING="5"><TR>   <TD VALIGN="TOP">   <P ALIGN=CENTER>    [ This page was updated: <!-- new date --> 11-Sep-2000 ]</TD></TR><TR><TD BGCOLOR="#CCCCCC"><SPACER TYPE="BLOCK" HEIGHT="1" WIDTH="1"></TD></TR></TD></TR></TABLE><TR>  <TR>    <TD>    <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">      <TR>        <TD WIDTH="50%">        <FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">        For more information on Java technology<BR>        and other software from Sun Microsystems, call:<BR>        </FONT>        <FONT SIZE="-1" FACE="Verdana, Arial, Helvetica, sans-serif">        (800) 786-7638<BR></FONT>        <FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">        Outside the U.S. and Canada, dial your country's         <A HREF="http://www.att.com/tollfree/international/dialguide/index.html">AT&amp;T&nbsp;Direct&nbsp;Access&nbsp;Number</A> first.<BR>        </FONT>        </TD>        <TD ALIGN="RIGHT" WIDTH="50%">        <A HREF="http://www.sun.com"><IMG SRC="../../../../images/lgsun.gif" width="64" height="30" border="0" ALT="Sun Microsystems, Inc."></A><BR>        <FONT SIZE="-2" FACE="Verdana, Arial, Helvetica, sans-serif">        Copyright &copy; 1995-2000        <A HREF="http://www.sun.com">Sun Microsystems, Inc.</A><BR>        All Rights Reserved.         <A HREF="../../../../share/text/termsofuse.html">Terms of Use</A>.         <A HREF="http://www.sun.com/privacy/index.html">Privacy&nbsp;Policy</A>.        </FONT>        </TD>      </TR>    </TABLE>	    </TD>  </TR> </TABLE></FORM><!-- End Copyright Insert -->  </BODY> </HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -