Why JUnit 5 default access modifier changed to package-private

Why is the default access modifier in JUnit 5 package-private? It’s not the “default”. There technically is no default. Rather, in JUnit Jupiter you have a choice: public, protected or package-private. What is the benefit of changing it to package-private? The benefit is that you don’t have type public anymore. If your IDE automatically generates … Read more

Why can a enum have a package-private constructor?

The constructor actually isn’t package-private… it’s implicitly private the way interface methods are implicitly public even if you don’t add the keyword. The relevant section of the JLS (ยง8.8.3) states: If no access modifier is specified for the constructor of a normal class, the constructor has default access. If no access modifier is specified for … Read more

Pros and cons of package private classes in Java?

The short answer is – it’s a slightly wider form of private. I’ll assume that you’re familiar with the distinction between public and private, and why it’s generally good practice to make methods and variables private if they’re going to be used solely internally to the class in question. Well, as an extension to that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)