The Artima Developer Community
Sponsored Link

Java Answers Forum
Question about condition ? expr : expr

1 reply on 1 page. Most recent reply: Mar 9, 2010 6:25 AM by Felipe Magarotto

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
Sicco Kolff

Posts: 1
Nickname: sicco
Registered: Mar, 2010

Question about condition ? expr : expr Posted: Mar 3, 2010 7:47 AM
Reply to this message Reply
Advertisement
* Why do i get a error.
* My java editor (Eclipse) says i should change the type of num to bolean.
* Which is not what i want and "isNumberPrime(int num)" returns a boolean.
* It's a complete mystery to me.
* code snippet:
* isNumberPrime(num) ? println(num + " is a prime") : println(num + " is not a prime");[\code]


Felipe Magarotto

Posts: 1
Nickname: felipem
Registered: Mar, 2010

Re: Question about condition ? expr : expr Posted: Mar 9, 2010 6:25 AM
Reply to this message Reply
If you did't solve yet...

System.out.println(isNumberPrime(num) ? num + " is a prime" : num + " is not a prime" );

Flat View: This topic has 1 reply on 1 page
Topic: Beanshell Programming Previous Topic   Next Topic Topic: Eckel thinking in Jave - 4

Sponsored Links



Google
  Web Artima.com   

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