Share on Google+Share on Google+

SCJP Module-1 Question-5

The given program module will help you in understating of some typical java codes and it will also help in preparation for SCJP

Given the sample code:

public class RoseindiaSample {
public static void main(String[] args) {
int k=5;
System.out.println(getBoolean()? k=3*k++:k+++ ++k);

public static boolean getBoolean(){
return false;
return true;

Select the correct sentences.


(1) Compilation error
(2) Print 12 on each time of execution
(3) Print random 12 or 15 at each execution.
(4) Print 7 or 9 at each execution.


The above code prints either 12 or 15 on each execution.


Posted on: July 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null