Certification Practice Exams!
HOME | NEWS | ARTICLES | CERTIFICATIONS | QUIZZES | PRACTICE TESTS | BOOKS | TRAINING | FAQ | FREEBIES
CERTIFICATION PRACTICE QUIZZES
Certification Advisor
Cost Calculator
CERTIFICATION WATCH
Get the latest certification news by email!

First name:


Last name:


*Your email address:


*Enter this security code:

FREE PUBLICATIONS:
More Titles...
OUR OTHER SITES:

GoExam: Certification practice tests with free demos to download.

GoTraining: Get Training on what you need.

CertificationBooks: Find the certification book you're looking for.

SearchCertify: links, links and more certification links!

NoMoreMalls: All of the shopping, none of the hassles.

Cheap Web Tricks: No cost or low cost tools for the frugal Webmaster.












Sun Certified Java Programmer Quiz #2 (SCJP 1.4)

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();
			System.out.println(i);
		}
	
		public void methodB()
		{
			System.out.println("The value must not be negative");
		}

		public static void main(String args[])
		{
			AssertTest test = new AssertTest();
			test.methodA(-10); 
		}	
	}	

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.



View the explanation

next







(c) Copyright 1998-2008 Anventure. All Rights Reserved.
contact us | advertise | privacy policy