What is the result?

Give:


What is the result?
A. 1525
B. 13
C. Compilation fails
D. An exception is thrown at runtime
E. The program fails to execute due to runtime error

Download Printable PDF. VALID exam to help you PASS.

One thought on “What is the result?

  1. The correct answer is A. 1525

    Try it yourself:

    class Alpha{
    public String[] main = new String[2];
    Alpha(String[]main){
    for(int ii = 0; ii < main.length; ii++){
    this.main[ii] = main[ii] + 5;
    }
    }
    public void main(){
    System.out.print(main[0] + main[1]);
    }
    }

    public class Test{
    public static void main(String[] args){
    Alpha main = new Alpha(args);
    main.main();
    }
    }

Leave a Reply

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


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