The Artima Developer Community
Sponsored Link

Java Answers Forum
Assert in java

1 reply on 1 page. Most recent reply: Apr 2, 2004 8:19 PM by Clay Dagler

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
nikki

Posts: 1
Nickname: nikki123
Registered: Apr, 2004

Assert in java Posted: Apr 2, 2004 10:10 AM
Reply to this message Reply
Advertisement
Hi people
im having a problem to compile my program
public int tokenToInt ()
{
Assert( IsNumber ) : "Tokens.TokenToInt: wrong kind of Token!"
return Value;
}

My compiler is having a problem recognising the : after the Assert(IsNumber)


Clay Dagler

Posts: 21
Nickname: cdagler
Registered: Jul, 2003

Re: Assert in java Posted: Apr 2, 2004 8:19 PM
Reply to this message Reply
> Hi people
> im having a problem to compile my program
> public int tokenToInt ()
> {
> Assert( IsNumber ) : "Tokens.TokenToInt: wrong kind of
> of Token!"
> return Value;
> }
>
> My compiler is having a problem recognising the : after
> the Assert(IsNumber)

Just by looking at java.sun.com Assert should be in the form:
Assert booleanExpression : Expression;
so, assuming IsNumer is a boolean I think
Assert IsNumber : "Tokens.TokenToInt: wrong kind of Token!";
should work.

Flat View: This topic has 1 reply on 1 page
Topic: case tools Previous Topic   Next Topic Topic: prptotyping

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use