Question

Write some java code to show that it has a runtime error. Provide your explanation of...

Write some java code to show that it has a runtime error. Provide your explanation of the error. What is the consequence of such error?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// This code will give you a runtime error

public class runtimeError
{

public static void main(String []args)
{
// divide a number by 0 to show runtime error
System.out.println("A number is being divided by zero\n");
System.out.println(5/0);
}
}

Runtime errors basically disrupts the normal functioning of the program and the program cannot execute until all the runtime errors are removed.

For example, divide by 0, syntax errors, logic errors etc.

Add a comment
Know the answer?
Add Answer to:
Write some java code to show that it has a runtime error. Provide your explanation of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT