File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Basic Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Basic Question" Watch "Basic Question" New topic

Basic Question

don cline
Ranch Hand

Joined: Oct 10, 2003
Posts: 35
This is a very basic question about syntax, embarrassed to ask, but I forget
the answer, and don't have my references here. I believe this is
a question fitting for this forum.
Consider the following code fragment:

This can be accomplished in a single line, something like:

Can someone help me?

chi Lin
Ranch Hand

Joined: Aug 24, 2001
Posts: 348
use the ? : operator.
[ June 26, 2004: Message edited by: chi Lin ]

not so smart guy still curious to learn new stuff every now and then
Greg T Robertson
Ranch Hand

Joined: Nov 18, 2003
Posts: 91
To be more precise it's
don cline
Ranch Hand

Joined: Oct 10, 2003
Posts: 35
I agree. Here's the link:
subject: Basic Question
It's not a secret anymore!