[HD-OCP17/21-Fundamentals Pg 0, Sec. 6.5.2 - accessing-static-members]

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

Moderator: admin

Post Reply
joaoclopes
Posts: 35
Joined: Mon Sep 23, 2024 4:49 pm
Contact:

[HD-OCP17/21-Fundamentals Pg 0, Sec. 6.5.2 - accessing-static-members]

Post by joaoclopes »

Code: Select all

class TestClass{
  public static void main(String[] args){
     ConnectionHelper c = null; 
     c.ping(); 
  }
}
Its saying
That's right. It will compile and run fine (of course, without any output).
But ping() method is private:

Code: Select all

class ConnectionHelper{
  static int idle_timeout;
  static String url;
  private static void ping(){ } //order of modifiers doesn't matter
  static public final void check(){ } //order of modifiers doesn't matter
}
And this makes the code fail to compile.

BR,
João Carvalho Lopes

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

Re: [HD-OCP17/21-Fundamentals Pg 0, Sec. 6.5.2 - accessing-static-members]

Post by admin »

You are right. Should be fixed.
thank you for your feedback!

joaoclopes
Posts: 35
Joined: Mon Sep 23, 2024 4:49 pm
Contact:

Re: [HD-OCP17/21-Fundamentals Pg 0, Sec. 6.5.2 - accessing-static-members]

Post by joaoclopes »

No problem! Glad that I helped.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests