1. There should not be more than 3 nested if-else/for/while. Ex. if() {if(){ while(){if()}}} is not allowed, because it will be hard to remember the logic.
  2. Don’t…

1. 1
2. 0.9999999999999999
3. 1.0000000000000001
4. 0.9999999999999999D
public class JavaChallenge38 {
public JavaChallenge38() {

public static void main(String[] args) {
1. Compilation Error
2. ClassA
3. ClassB
4. ClassC
5. ClassC can not be cast to ClassB
return (ClassA) o; 
1. Compilation fails because no SQLException is thrown.
2. Throws ClassCastException because SQLException is not instance of RuntimeException.
3. No problem, the program prints the stacktrace of newly thrown SQLException.
4. Compilation fails because we can not cast SQLException to RuntimeException.

Govinda Raj

Senior Software Developer. Tech Enthusiast and love coding. My portfolio: https://govinda-raj.github.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store