The IT Certification Resource Center

Featured Deal

Get CompTIA, Cisco, or Microsoft training courses free for a week.
Learn More ❯
Today's Deal

This practice quiz contains 30 questions, provided by Whizlabs Software.

Question 1:

What will happen when you attempt to compile and run the following code?

(Assume that the code is compiled and run with assertions enabled.)

    public class AssertTest
        public void methodA(int i)
            assert i >= 0 : methodB();
        public void methodB()
            System.out.println("The value must not be negative");
        public static void main(String args[])
            AssertTest test = new AssertTest();

A. It will print -10
B. It will result in Assertion Error showing the message -"The value must not be negative".
C. The code will not compile.
D. None of these.