I often find that when a program is convenient to debug, (though arguably poor practice) a return within a block Code to insert statement. I can try to do something like this in Java ....
class test {public static zero main (string array []) {System.out.println ("Hello World") ; Return; System.out.println ("I think this line can cause a problem"); }}
Of course, this compiler will generate errors.
Test.java:7: irreversible statement
I could understand why a warning can not be justified because the unused code is bad behavior but I understand It is not coming in why it is necessary to create an error.
Is it just Java trying to become a nanny, or is this a good reason to make a serious error?
Because the uncompressed code for the compiler is meaningless, however, making people meaningful to code For making meaningful for a compiler, both are paramount and difficult, compiler is the essential consumer of code. Designers of Java take the approach that the code that is not meaningful to the compiler, is an error. His view is that if you have some indispensable code, then you have made a mistake which needs to be fixed.
There is a similar question: In which the author says, "Personally, I strongly believe that it should be an error: If the programmer writes a piece of code, then it is always in a scenario Should be with the intention of walking. "Clearly the language designers of Java have agreed.
Unusual code is a question to prevent compilation, which will never be agreed upon. But that is the reason that the Java designer did this.
Many of the comments show that the Java CluKet is not accessible, Java does not compile. If I understand the results of Godel correctly, then no compiler can possibly be accessible to all sections.
Unit testing can not catch every bug, we do not use it as a logic against their value. Similarly a compiler can not catch all problematic code, but it is still valuable because it Can stop the bad code to be compiled.
Java language designers consider the irreversible code as an error, so it is possible to compile it when compiling, if possible.
(Before you downvote: The question is not that there must be an indispensable statement compiler error in Java. The question is why why is an unreadable statement compiler in Java There is an error. Do not downgrade me just because you think Java has made the wrong design decision.)
Comments
Post a Comment