I'm confused, when executing following code:
@Test
public void testAccessible() throws NoSuchMethodException {
Constructor<LinkedList> constructor = LinkedList.class.getConstructor();
Assert.assertTrue(constructor.isAccessible());
}
the assertion fails, but LinkedList class has public
default constructor. So why isAccessible() returns false?
getModifiers()
method to determine accessibility/modifiers,isAccessible()
exists for different purpose.