Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assertions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assertions" Watch "Assertions" New topic


Divya Eknath

Joined: Jul 27, 2006
Posts: 9
which of the following line causes a compiler error?

public static void main(String[] args)
assert false;
assert false;
public static void method()
assert false;
assert false;
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

line 1 in Above code is unreachable so it is compile time error.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Please use tags and format your code. Thanks.

Did you compile the code yourself?
[ July 29, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Check this thread.
I agree. Here's the link:
subject: Assertions
It's not a secret anymore!