This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line!
See this thread for details.
Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Jqplus

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this question is from jqplus exam.
Q:
Which operators will always evaluate all the operands?
A. &&
B. | |
C. |
D. ?:
E. %
given answer are 'C' and 'E'. but i think that 'E' is not a correct choice.
lets take a example here :
int c,j
j = 2
c = get() % (j=3)
System.out.println(j) //it will print 2
And method get():
int get(){
throw new Exception();
}

am i correct ??
feel free to correct me.
vivek
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I feel the System.out.println will never be printed as an exception is raised. What you are saying about partial execution via exception is tru of any operator and in that case the answer to uyour question should be none of the above.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Lancy.
Exception will cause the abnormal termination of the expression evaluation process. The question here and almost all the questions in the exam, unless explicitly stated, should be considered under normal circumstances only.
Ajith
 
Don't touch me. And dont' touch this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic