Page 1 of 1

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

Posted: Sun Nov 03, 2024 6:44 am
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

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

Posted: Sun Nov 03, 2024 9:15 pm
by admin
You are right. Should be fixed.
thank you for your feedback!

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

Posted: Mon Nov 04, 2024 1:44 pm
by joaoclopes
No problem! Glad that I helped.