What is the result?

Given:
public class Pass {
public static void main(String [] args) {
int x = 5;
Pass p = new Pass();
p.doStuff(x);
System.out.print(" main x = " + x);
}
void doStuff(int x) {
System.out.print(" doStuff x = " + x++);
}
}
What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. doStuff x = 6 main x = 6
D. doStuff x = 5 main x = 5
E. doStuff x = 5 main x = 6
F. doStuff x = 6 main x = 5

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.