About Question enthuware.ocajp.i.v8.2.1418 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Dreamweaver
Posts: 32
Joined: Mon Dec 29, 2014 4:14 pm
Contact:

About Question enthuware.ocajp.i.v8.2.1418 :

Post by Dreamweaver »

fair enough but what if condition is a static instance variable or I use

Code: Select all

new Test().condition

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1418 :

Post by admin »

Not sure how that effects the question or the options. You still need to select two options from the given options.

Dreamweaver
Posts: 32
Joined: Mon Dec 29, 2014 4:14 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1418 :

Post by Dreamweaver »

I thought that the first answer would also be correct

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1418 :

Post by admin »

Ok, I see your point.
But you have to go with the general assumptions about the code appearing in the exam questions. You can only assume that everything not shown in the given code (i.e. the context) does not affect the working on the given code. So, you don't have to over think about what might be present outside the given code. The only thing that exists is appropriate imports and a valid class/method.

edufin166@yahoo.com
Posts: 24
Joined: Wed Sep 28, 2022 9:41 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1418 :

Post by edufin166@yahoo.com »

For JAva 17, it does not valid anymore.. the code below compile..

Code: Select all

    for (long l = 1L; l < 4000000000000L; l++) {
      System.out.println("\n");
      switch ("test" + l) {
        case "test1":
          System.out.println(text + "long 1");
          break;
        case "test2":
          System.out.println(text + "long 2");
        case "test3":
          System.out.println(text + "long 3");
          break;
        default:
          System.out.println(text + "long Others");
      }
    }

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1418 :

Post by admin »

What is not valid?? Which option do you think is not correct?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests