dimanche 29 octobre 2017

Java Squiggly Line (~) Meaning? [duplicate]

This question already has an answer here:

In another stack overflow post, I saw some Java code like this, related to reflection:

public void setFinalStatic(Field field, Object newValue) throws Exception { field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(null, newValue); }

I noticed that there is a squiggly line "~" in front of Modifier.FINAL. What is this "~"? I've never seen it before in Java code. I copied and pasted the code into Eclipse and it compiles so it's valid code.

Thank you in advance.





Aucun commentaire:

Enregistrer un commentaire