Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
Assertion
Satyajeet Kadam
Ranch Hand
Posts: 224
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Assertion Error:
Please tell where is the problem
public class Ass { public static int y; public static void foo(int x) { System.out.println("foo"); y=x; } public static int bar(int z) { System.out.println("bar"); return y=z; } public static void main(String args[]) { int t=0; assert t>0:bar(7); assert t>1:foo(8); System.out.println("done"); } }
Anton Uwe
Ranch Hand
Posts: 122
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
"assert t>1:foo(8);" surely will not compile, because "foo(8)" does not evaluate to a value. But what do you mean with "problem"?
Anton Uwe
Ranch Hand
Posts: 122
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Edit: Double post due to a forum error.
[ March 06, 2007: Message edited by: Anton Uwe ]
Atul Sawant
Ranch Hand
Posts: 304
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
assert should return anything but void.
Mission SCWCD. Mission SCJP Complete: SCJP 1.4 - 91%
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
assert
Assertion topic
two possible answers Q18 ch 4 page 282 from KB
Qn on assertion.
How to turn on assert in TextPad ?
More...