Since 's introduction in JDK 1.0, Java introduced 9 more versions.  Yet, despite its clear , it is still available, even in JDK 10.  Oracle itself states in :     The finalize() Method      The Object class provides a callback method, finalize(), that may be   invoked on an object when it becomes garbage. Object's implementation   of finalize() does nothing—you can override finalize() to do cleanup,   such as freeing resources.      The finalize() method may be called automatically by the system, but   when it is called, or even if it is called, is uncertain. Therefore,   you should not rely on this method to do your cleanup for you. For   example, if you don't close file descriptors in your code after   performing I/O and you expect finalize() to close them for you, you   may run out of file descriptors.   Which begs the question: Are there any known proper uses of this method?
I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources.  I saw someone comment that they use it to clean up Connections, which is really scary since the only way to come as close to a guarantee that a Connection is closed is to implement try (catch) finally.    I was not schooled in CS, but I have been programming in Java professionally for close to a decade now and I have never seen anyone implement finalize() in a production system ever.  This still doesn't mean that it doesn't have its uses, or that people I've worked with have been doing it right.  So my question is, what use cases are there for implementing finalize() that cannot be handled more reliably via another process or syntax within the language?    Please provide specific scenarios or your experience, simply repeating a Java text book, or finalize's intended use is not enough, as is not the intent of this question.
How is the "charge on a capacitor" defined when two plates are unequally charged? In Concepts of Physics by Dr.. H.C.Verma, in the chapter on "Capacitors", in page 144, under the topic "Capacitor and Capacitance" the following statement is given:     A combination of two conductors placed close to each other is called a capacitor. One of the conductors is given a positive charge and the other is given an equal negative charge. The conductor with the positive charge is called the positive plate and the other is called the negative plate. The charge on the positive plate is called the charge on the capacitor …   Note that the term charge on a capacitor does not mean the total charge given to the capacitor.   (Emphasis mine)  According to the above statement, "the charge on the capacitor" is the charge on the positive plate when both positive and negative plates of a capacitor are equally charged? How to extend this definition when the two plates are unequally charged?   Suppose we supply charges $+Q_1$ and $-Q_2$ to the positive and the negative plates respectively. After electrostatic conditions are attained, I determined the charge distribution on the four surfaces - outer surfaces and inner surfaces of the two plates. The charge on the outer surfaces of the two plates are equal to $\frac{Q_1-Q_2}{2}$. The magnitude of charge on the inner surface of the two plates is $\frac{Q_1+Q_2}{2}$.   Now coming to my doubt, if the "charge on the capacitor" is the charge on the positive plate, which surface of the positive plate should I want to consider - the outer one or the inner one? And what is the reason for this choice? It seems to me that, a capacitor with unequal charges on its plates is not a capacitor in the first place (inferred from the statement above). How can I get Gnome3 to remember my session? I am running Gnome3, but I had the same problem with Unity, on Ubuntu 12.04.  I have a fairly elaborate setup I enjoy using day-to-day. A LibreOffice spreadsheet with everyone's extension numbers; a window with reference data I use regularly; two mulit-tabbed Konsole/Terminal windows with several remote systems sessions, firefox with a set of open tabs, and so on. But whenever I log out, when I return, I must set up everything from scratch. I remember the good 'ol days, when I rebooted, I'd re-log in, and all my windows came back up in the same places as they were when I logged out, and my Konsole/Term would come up with the same remote logins as before.... I'd have to re -setup  some of my programs, but that's better than having to move every win into place, and resize them, etc.  How do I get this functionality back? Schengen Visa Application: what are some helpful tips for preparing? I am looking for a quick way to sleep without closing the lid, or using the mouse.  If it matters, I have Lion version OS and a MacBook Air. Output of getent group Trying to understand what is a p value I am trying to understand what a p value is and what is its importance in statistics, from this example.  For $50$ specimens of alloy steel the rock hardness scale measured an average of $62$ with standard deviation $8$ he manufacturer claims that the alloy has average strength of $64$ at significance of $0.01$ can you refute this?  Well I did this problem and saw no at this level you cant refute it , I use the null being that the hardness was $64$ and the alternate that the hardness was less then $64$. From the data we observe a $z=-1.7677$ but the chart is $z=-2.33$ and so we cant refute null at this level.  But now I want to understand what the p value would be ,  I thought it was that the p-value is the probability of getting the observed value of the test or a value with even more evidence against the null if the null is actually true. So using that I just look on the z chart, the probability of seeing Z greater then $1.7677$ is $0.0384$, so is that the p value? Behave as if it was or it were You can place the script in the head or body as you like. The   script will behave as if it was located exactly where you put the   script tag in the document.   The sentences above are taken from  (at the very bottom). I think they made a grammatical mistake here: it should be behave as if it were rather than it was. I'm not 100% sure, so want to confirm it. caching JavaScript files Which is the best method to make the browser use cached versions of js files (from the serverside)? Finding the value of $\int_0^{\pi/2} \frac{dt}{1+(\tan(x))^{\sqrt{2}}}$ The problem: Find the value of $\displaystyle\int_0^{\pi/2} \frac{dx}{1+(\tan(x))^{\sqrt{2}}}$   I tried a few different substitutions and the closest I got to an okay looking integral is $$\int_0^\infty \frac{t^2 \, dt}{t^{1/\sqrt{2}}(1+\sqrt{t})},$$ which still looks scary. How do I approach this integral? Unable to upgrade pip Java obfuscators I'm looking for a good Java obfuscator.  I've done initial research into the following Java obfuscators: proguard, yguard, retroguard, dasho, allatori, jshrink, smokescreen, jobfuscate, marvin, jbco, jode, javaguard, jarg, joga, cafebabe, donquixote, mwobfu, bbmug, zelix klassmaster, sandmark, jcloak, thicket, blufuscator, and java code protector.  I tried proguard and it has a really nice GUI, seems really stable, and seems to be the most popular, but it seemed to not like some enumeration on a referenced jar file (not within the code I was trying to obfuscate) which was weird.  Yguard seems to require some interaction with ant, which I didn't know too much about.  What is a good java obfuscator?  It doesn't need to be free, it just needs to work well and be easy to use. Now that Lightning is here, what's the future of Visualforce? (in short - Visualforce vs Lightning) As a developer, just curious to know what's the future of Visualforce (pages, components, email templates, etc..) ??  I believe for sure there will be backward compatibility so that the existing ones will still run.  But what's gonna happen next (say after couple of releases when lightning becomes GA &amp; goes mainstream). ??    will Salesforce stop customers from using VF for new development ? will VF &amp; L work together (like embed one in another or call one from another) is it possible to migrate / upgrade existing VF to L without rewriting ?   Just a few questions i can think of now.. but in general if any of you know more details on these, please share with us..  Thanks Remove space before punctuation I need to remove locally spaces arround (especially before) punctuation signs. This spaces are added by french polyglossia.  \documentclass{article} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{french}  \newcommand{\nospace}[1]{\texttt{#1}}  \begin{document} \nospace{a:b} \end{document}     Thanks for help. Vertex of a pentagon-Does the algorithm always stop? To each vertex of a pentagon,we assign an integer $x_{i}$ with sum $s=\sum x_{i}&gt;0$. If x,y,z are the numbers assigned to 3 successive vertices and if $y&lt;0$,then we replace $(x,y,z)$ by $(x+y,-y,y+z)$.This step is repeated as long as there is a y&lt;0.Decide if the algorithm always stops. proof that every finite matrix has an annihilating polynomial Is this a plant or a fungus? It was soft and covered in flies. My guess is fungi.  Location: South Florida. Parent Field in Lightning Datatable Are Parent Fields supported in lightning Datatable?  I'm trying to display Account Name with Contact information, but it seems parent fields are not supported in lightning datatable.  Component:  &lt;aura:component controller="PagingSortingController"&gt;     &lt;aura:attribute name="mydata" type="Object"/&gt;     &lt;aura:attribute name="mycolumns" type="List"/&gt;     &lt;aura:handler name="init" value="{! this }" action="{! c.init }"/&gt;     &lt;lightning:datatable data="{! v.mydata }"          columns="{! v.mycolumns }"          keyField="con.id"         onrowselection="{! c.getSelectedName }"/&gt; &lt;/aura:component&gt;   Controller:  ({     init: function (cmp, event, helper) {     cmp.set('v.mycolumns', [                 {label: 'Contact Name', fieldName: 'Name', type: 'text'},                 {label: 'Phone', fieldName: 'Phone', type: 'phone'},                 {label: 'Email', fieldName: 'Email', type: 'email'},                 {label: 'Account Name', fieldName: 'Account.Name', type: 'text'}             ]);         helper.getData(cmp);     }  })   Helper:  ({     getData : function(cmp) {         var action = cmp.get('c.getContacts');         action.setCallback(this, $A.getCallback(function (response) {             var state = response.getState();             if (state === "SUCCESS") {                 cmp.set('v.mydata', response.getReturnValue());             } else if (state === "ERROR") {                 var errors = response.getError();                 console.error(errors);             }         }));         $A.enqueueAction(action);     } })   Apex Controller:  @AuraEnabled     public static List&lt;Contact&gt; getContacts() {         List&lt;Contact&gt; contacts =                  [SELECT Id, Name, Phone, Email,Account.Name FROM Contact];         return contacts;     } C# equivalent to wildcard imports in Java Is there a way in C# to import everything inside a namespace like there is in Java with the wildcard character?  import java.awt.*; Why are there no line numbers in the code listings? Would it make discussing code easier if you could simply refer to a particular line or range, or am I wrong? Problem with patching babel package I am trying to use babel and biblatex package together but I am getting following error:    ! Package biblatex Error: Patching 'babel' package failed.    This is my code example:  \documentclass[12pt,a4paper,twoside,openright]{book} \usepackage{cmap} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[slovak]{babel} \usepackage{xpatch} \usepackage{csquotes} \usepackage{biblatex} \begin{document} \enquote{quote} \end{document}   I would need the result look like this:    Well, it seems like I could get rid of the error when using xpatch package, but it works only when I delete 'slovak' option for babel package. That way the result look like this:    Please, is there any workaround for this problem? I am really stuck in this.