About Question enthuware.ocpjp.v11.2.3503

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

Moderator: admin

Post Reply
asherjackson
Posts: 1
Joined: Thu Aug 29, 2024 3:27 am
Contact:

About Question enthuware.ocpjp.v11.2.3503

Post by asherjackson »

public class TestOuter { public static class TestInner {
public void sayIt(){ System.out.println("hello"); } }
public static void main(String[] args){
//call here
} }

Why TestInner.sayIt(); cannot be the the second answer?

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

Re: About Question enthuware.ocpjp.v11.2.3503

Post by admin »

The explanation below this option says,
TestInner is static but its method sayIt is not. So, you need to do new TestInner().sayIt(); in main to invoke sayIt."
Seems quite clear. Please let us know which part is causing confusion so that additional explanation can be provided.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests