Error Handling mechanism [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Why errors are not handled? Since Error class is derived from Throwable class(JAVA) it can also be handled.But why it is not a good practice to handle the error?

Compilers are not predictive to get the result exactly in the format humans want.
They obviously work on the limited syntax and semantics rule and as per some grammar (or rules you can say).
Errors are also Exceptions in Java that define exceptions which aren't expected to be caught under normal circumstances.
So basically, an error is that problem which requires human handling for getting the correct result. Also, your assumption that errors aren't handled is incorrect, as errors are reported like errors occurring during runtime. But, they don't specifically correct the error and also they don't provide much detail about the error.

Related

I have problem with java.lang.reflect.InvocationTargetException [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
it's the error I'm not good at programming but I try to learn. I am learning how to use javaFx. In this case I want to implement 4 operations: add, subtract, multiply and divide. When I was using only one it worked for me I am new to the Starck overflow community. I always check when I have doubts. But I did not find a solution to my problem. It would be very helpful if you support me.
If you like me to share the folder. They explain to me how it would be very helpful.
Also my english's not good but i'm learning to
See this post on InvocationTargetException
See the Oracle Documentation on RuntimeException
See this post on javafx.fxml.LoadException
**As noted in the comments, the stack trace, in your case the red error text, tells you one of the problems: ** "Error resolving onAction = '$handleResta', either the event handler is not in the Namespace or there is an error in the script".
The comments are also asking for the file which contains the error, in order to help you more fully; We've identified that onAction = '#handleResta' is a problem problem, but we can't tell what about #handleResta is creating the error until you post this file:
/C:Users/Usuario/Downloads/Proy/build/classes/mvvm/FXMLVista.fxml:14

Java source code parsing [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to track down a java variable in a java file - which variable it got assigned to, which method it was passed to.
How should I begin with?
Should I use line by line parsing or is there any other method?
It looks like you are asked to build a huge mansion; and you start by asking: "should my shovel to dig the cellar be better round; or more rectangular". Meaning: if you don't understand that parsing a java program requires more than "line by line" reading; then you are doomed to fail.
Anyway, depending on your underlying requirements, there are two possible answers:
As suggested by duffymo, you might want to learn using an IDE which allows you to easily identify "variable usage" within a project; and make modifications via "reflection"
Start using a fully fledged Java parser; like https://code.google.com/p/javaparser/wiki/UsingThisParser

Synchronization paragraph from java documentation [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
everyone!
I am reading java doc from this:
https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html
Could anyone,please, tell more about
The Java programming language neither prevents nor requires detection
of deadlock conditions. Programs where threads hold (directly or
indirectly) locks on multiple objects should use conventional
techniques for deadlock avoidance, creating higher-level locking
primitives that do not deadlock, if necessary.
Thanks.
It means that "Do not expect java to handle OR avoid deadlocks for you. If you do not write your code properly then there is no way java will tell you in advance. So, it is your responsibility to make sure your code does not cause any deadlocks".
Basically, this paragraph states that Java won't handle deadlocks for you - it's your responsibility to avoid them.

user defined functions vs built in function in java five relevant differences over time and space complexities [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Please explain me the differences over time and space complexities in java for user defined and predefined functions in java. examples like, linked list, list, stack class. please explain this with valid example.
thank you.
There is nothing special in predefined function over user defined. The only thing is predefined has been written by somebody else for you. It depends on algorithm.
Crap code/implementation runs in a crap way. Doesn't matter if its user created or system/API provided. example at a high level is EJBs vs Spring.
Good written code runs pretty and sleek. Again doesn't matter who the hell wrote it.

The Best way to write custom exception name in java [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just wonder about best way to write custom exception name, like if I have user and i want make exception for add and delete and update, what is better using names like :
UserAddException
UserUpdateException
UserRemoveException or UserDeleteException ?
or like:
UserAdditionException
UserUpdateException
UserDeletionException
Exception name must describe what it handle, but not sure use "verb" describe the action where exception happened or "noun" as what exception itself do.
What I want to understand here the best way that make developers understand my exception usage and what to use later, and if there is pattern or standard used for Java development in this case.
I would go with the second type of exception names. The reason why I would say that is because the exception: InstantiationException uses the noun InstantiationException. However, he most important thing is that you are consistent with the naming of exceptions and that the exception names give the development team a clear idea of what those exceptions indicate and their meaning. That is really the critical thing here.
What I would do will be, use UserManagementException instead of too many names, and specify the exact cause of it in some message or error code defined additionally in the class.

Categories