|
I had the general view that clean up of resources is done in the finally{} block,
recently I found this particular code snippet in a class and it was overriding the Object class' finalize() method.
protected void finalize() { try { In.close(); Out.close...
Started by Kevin Boyd on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
However, it is often found to clean up such things in finalizers as a last-ditch safety valve should a finally block throw another exception....
Cleaning up in finalize is not guaranteed to occur.
Always clean up things in finally.
|
|
Another interview question which was expecting a true / false answer and I wasn't too sure.
Duplicate http://stackoverflow.com/questions/582095/in-net-what-if-something-fails-in-the-catch-block-will-finally-always-get-call http://stackoverflow.com/questions...
Started by Gais on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
There are a couple of exceptions (see other answers for more... .
Generally the finally block is always executed regardless of whether an exception is thrown or not and whether any exception is handled or not.
Yes, finally is always executed.
|
|
I have a class defined as final. Does it make sense to define the methods as final as well? I know that since the class itself is final it can't be extended, which would make the method final declarations redundant, but I want to work up documentation...
Started by onassar on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
So, it....
If you define a class as final, then class can't be extends any more but if you define any of the methods final then those methods can't be overridden or extended to add more functionality.
That the methods are final to.
|
Ask your Facebook Friends
|
Basically I've heard that certain conditions will cause .net to blow past the finally block. Does anyone know what those conditions are?
Started by Chris Lively on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Two possibilities:
StackOverflowException ExecutingEngineException....
I think finally should always execute.
Unless the CLR blows up and goes down with an ExecutingEngineException (I've seen a few in the .net 1.1 days with just the right amount of COM Interop :) . .
|
|
I've just come across some code that's confusing me slightly; there are really 2 variations that I'd like to clarify.
Example 1:
public String getFilepath(){ final File file = new File(this.folder, this.filename); return file.getAbsolutePath(); }
What...
Started by froadie on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Some coding conventions advocate having all variables final unless they need tell you that there's a performance benefit....
It has no meaning outside the method.
final in this case just means that the local reference file will be immutable.
|
|
What is the point of finalizing CD/DVDs from user's point of view? First of all does it have any impact on reliability of media or it's just a way to ensure that the content of the disk cannot be changed?
I wonder because I use DVDs to store my system...
Started by wheleph on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at superuser):
|
|
I understand how try-catch works and how try-finally works, but I find myself using those (usually) in two completely different scenarios:
try-finally (or using in C# and VB) is mostly used around some medium-sized code block that uses some resource that...
Started by Heinzi on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
A quote from MSDN
A common usage of catch and finally together is to obtain and ....
I would nearly always use try-catch-finaly in cases where you need to dispose something in all cases and you use the case to log the error and/or inform the user .
|
|
Hello everyone! First off I want to apologise for being so late with all this. I've been really busy lately and stuff like this has to take a backseat. So we're down to our final 16.
LPSG Cock Wars - Quarter Finals
From now on, the game is played in a...
Started by everyday_regular on
, 15 posts
by 13 people.
Answer Snippets (Read the full thread at lpsg):
What do I do now?!
Do I give his....
Conchis
Voting is now open! Grr, ThomasJohnThomas has closed his account .
YoungCock1234
Match 4
ThomasJohnThomas VS.
SyddyKitty
Match 3
joshdaniels1234567 VS.
Bighitter
Match 2
serium VS.
Group One
Match 1
7ingirth VS.
|
|
I'm taking a class in PHP and I'm a real newbie when it comes to best practices and whatnot.
I have a little homework that the teachers wants me to hand in.
Create a form that asks a user for his name, last name, age and birthday.
When the users clicks...
Started by Sergio Tapia on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Sessions store an ID on the computer, (sometimes in a... .
You need sessions.
When rendering the second form you could include all the fields from the previous form as hidden fields .
Make sure you clear it when you are done saving the data .
Use session..
|
|
Hey guys, I know it's been some time since I've been gone, if you haven't heard by now I was diagnosed with a stress induced ulcer after I passed out shortly after completing a school assignment.
I apologize for being gone so long, it wasn't my intention...
Started by ShiniKaze on
, 16 posts
by 12 people.
Answer Snippets (Read the full thread at acecombatskies):
ShiniKaze, on 16 December 2011 ....
Sour, on 08 October 2011 - 07:36 PM, said:
My blood type is Haterade .
I missed you.
パンダズカ! Welcome back.
I assumed you left ACS after AC:AH's activity started dying .
I wondered what happened to you.
Welcome back, Shini.
|