Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock: assertion

 
adam Lui
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. public class AssertionTest {
2. public static void main(String[] args) {
3. // insert here
4. System.out.print(" After assert");
5. }
6. }
Which of the following inserted at line 3 will generate the assertion error with the message Test?
A. assert (true): Test;
B. assert (false): Test;
C. assert (true): "Test";
D. assert (false): "Test";
E. assert false: "Test";













===========================
answers are : D and E
but doesnt it use that IF condition format ( condition: true? false)?
 
raghu dubey
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. It does not use the IF format. See K&B chap 5...last 4-5 pages of that chap.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic