Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Campbell Ritchie wrote:But there are design principles for closing files and databases.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Ivan Jozsef Balazs wrote:The try-with-resources construct is useful for resource management.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Is that before or after you reboot your computer ?Tim Holloway wrote:. . . the garbage collector would do the closing. Which it should. Eventually.
Yes, so many tutorials showed a plain simple close(); call but you really needed it in a finally block.Tim Holloway wrote:[try-with-resources is] also relatively recent . . .
Campbell Ritchie wrote:
Yes, so many tutorials showed a plain simple close(); call but you really needed it in a finally block.Tim Holloway wrote:[try-with-resources is] also relatively recent . . .
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
The __FILE__ and __LINE__ were macros in C/C++ but wouldn't have to be in Java. Yes, you can get those from stack trace information but that has run time overhead that a compute at compile time needn't have. With Java I end up with something like this, but I'm open to better solutions.Tim Holloway wrote:.... Also, __FILE__ and __LINE__ aren't really applicable in Java since Java doesn't have a pre-processor like C or C++. The file and line information are stored as part of the class for use in stack traces.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Carey Brown wrote:FILE and LINE would become String and int constants which I presume to be cheaper than creating a Throwable object at run time.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Tim Holloway wrote:__FILE__ and __LINE__
Ivan Jozsef Balazs wrote:
Tim Holloway wrote:__FILE__ and __LINE__
Nobody prevents us from running Java (pre-) code through a C(++) precompiler :-)
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
Agree there.meenal deshpande wrote:It depends . . .
What evidence do you have for that?C++, on the other side:
. . . is faster. . . .
Because it supports direct manipulation of pointers.is used for writing operating systems . . .
Hahahahahahahahahaha!makes shooting yourself in the foot very easy . . .
I have seen so many people who think that C++ and Java® work the same way, when they don't.Knowing one is a solid foundation for learning the other, though be advised that even if their syntax is very similar, they work in a different way and preferred ways of doing things will probably differ.
meenal deshpande wrote:..C++ and Java both are the Object oriented programming language, which one is the best it’s tough ...
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
As a rule of thump C++ today can be used whenever Java is used and the opposite is also true
Harry Kar wrote:
meenal deshpande wrote:..C++ and Java both are the Object oriented programming language, which one is the best it’s tough ...
As a rule of thump C++ today can be used whenever Java is used and the opposite is also true but that's only a rule of thump
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Tim Moores wrote:
As a rule of thump C++ today can be used whenever Java is used and the opposite is also true
I disagree. It's true in the sense that both languages are Turing-complete, and there's nothing that one of them can do that the other can't do in principle...
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
Tim Holloway wrote:
Harry Kar wrote:
meenal deshpande wrote:..C++ and Java both are the Object oriented programming language, which one is the best it’s tough ...
As a rule of thump C++ today can be used whenever Java is used and the opposite is also true but that's only a rule of thump
Actually, the term is "rule of thumb. It's based on the idea that you can use your thumb as a rough unit of measurement - handy if you don't have the Pharoah's foot handy.
Java requires a virtual machine to run in, so it doesn't work very well at the lowest OS levels ....
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Tim Holloway wrote:I suppose the best translation of "rule of thumb" would be "this is good enough for discussion, but don't calculate any Martian landings based on it".
The "Fortran" computer was Prime Computer...
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
Tim Holloway wrote:I suppose the best translation of "rule of thumb" would be "this is good enough for discussion, but don't calculate any Martian landings based on it".
The "Fortran" computer was Prime Computer...
[Arguing with an engineer is a lot like wrestling in the mud with a pig. After a few hours, you realize that he likes it] [Learn code first? no we apply to learn programming(or also)first thanks]
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|