wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assertions" Watch "Assertions" New topic
Author

Assertions

Divya Eknath
Greenhorn

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

public static void main(String[] args)
{
method();
assert false;
assert false;
}
public static void method()
{
while(true)
{
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Assertions
 
Similar Threads
Assertions
Assertion Quesion 2:can you explain the reason
Can u explain this assert question
Doubt in Assert statement
mock: assertion