File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

for each loop

 
akash shrimali
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we perform ternary operation in new enhanced FOR EACH LOOP [ EX ... for(int element:arr) { System.out.println(element); } ]
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your example does not have a ternary operation and it is not obvious to me what is not obvious to you. Can you elaborate?
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Akash,

it doesn't seem so clear to me what you want to achieve.

Following your example:



Would you like to give to element variable a value depending on a condition? If that is the question, no is the answer

But you can choose the array or list to navigate through, depending on a conditional operator's result



Tell me if you meant something else.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic