+ 1

Any one tell me the description of Error in programming responsible.

what is compiling error and how it occur,run time error and how it occur and any other error????

19th Aug 2018, 7:58 AM
Samrat✌✌
Samrat✌✌ - avatar
4 odpowiedzi
+ 1
Java, for instance, is a compiled language. Without an IDE or sololearns playground you would write a .java file, use the command line to compile the program and then run the compiled file. If this process fails, it is a compile time error and can be caused by incorrect syntax, or using incorrect types with the generic system (don't worry if you don't know about this, just an example). Runtime errors happen when the program has been compiled and is actually running. An example could be trying to access a property or method of a null object reference. The code is fine and will compile but at runtime this can't be executed
19th Aug 2018, 8:34 AM
Dan Walker
Dan Walker - avatar
+ 1
Dan Walker can u explain more in compiled error☺
19th Aug 2018, 9:21 AM
Samrat✌✌
Samrat✌✌ - avatar
+ 1
So, the below won't compile, meaning I can't even start to run it: public class MyClass { private Number int = 5; } because in Java you have access modifier, declared type, then variable name (identifier), but here I've used the reserved keyword 'int' as my identifier. This program will not compile. So if I tried to run javac MyClass.java on the command line, it would complain and the compilation would not complete, so I'd have no program to actually run. Another example would be having two methods with the same signature like public int myMethod() {// do stuff} public long myMethod() {// do some different stuff} This will fail because the compiler will not allow you to define methods like this, who only differ by their return type. That's just a few examples, because there are many ways that a compilation will fail, and this will be alerted in the sololearn console when you try to run it. Runtime exceptions will say something like "exception in Main: line 10" etc. Compilation errors are useful because they alert us to problems before we run the program. Imagine a large application and you have to navigate to a particular part of the system to see if it fails - this is time consuming and by no means guaranteed that you'll find an issue. When generics were introduced in Java it added more compile time safety regarding types, whereas before a runtime exception might happen because of incompatible types being used.
19th Aug 2018, 10:32 AM
Dan Walker
Dan Walker - avatar
+ 1
Dan Walker thank u buddy
19th Aug 2018, 2:28 PM
Samrat✌✌
Samrat✌✌ - avatar