Compile and Run code in assertion in java
Compile and run code using assertion, Note: The Java 6 compiler will use the assert keyword by default. Unless you tell it otherwise, the compiler will generate an error message if it finds the word assert used as an identifier. However, you can tell the compiler that you're giving it an old piece of code to compile, and that it should pretend to be an old compiler! Here is a code: -------------------------Assertiontest.java---------------------------------------------------------- class AssertionTest{ public static void main(String [] arg){ int num=Integer.parseInt(arg[0]); assert num>=0 : "The number you have provide by command line argument is not a positive number:"+num; System.out.println("This number is positive:"+num); // This will execute if number is positive } } --------------------------------------------...