No Image

How to use typesafe enums in Java

12 11 月, 2020 Jeff Friesen 0

Java code that uses traditional enumerated types is problematic. Java 5 gave us a better alternative in the form of typesafe enums. In this article, I introduce you to enumerated types and typesafe enums, show you how to declare a typesafe enum and …

No Image

How to use assertions in Java

10 9 月, 2020 Jeff Friesen 0

Writing programs that work correctly at runtime can be challenging. This is because our assumptions about how our code will behave when executed are often wrong. Using Java’s assertions feature is one way to verify that your programming logic is sou…

No Image

How to describe Java code with annotations

23 7 月, 2020 Jeff Friesen 0

You’ve probably encountered situations where you need to associate metadata (data that describes other data) with classes, methods, and/or other application elements. For example, your programming team might need to identify unfinished classes in a …

No Image

Packages and static imports in Java

12 5 月, 2020 Jeff Friesen 0

In my previous Java 101 tutorial, you learned how to better organize your code by declaring reference types (also known as classes and interfaces) as members of other reference types and blocks. I also showed you how to use nesting to avoid name con…

No Image

Packages and static imports in Java

12 5 月, 2020 Jeff Friesen 0

In my previous Java 101 tutorial, you learned how to better organize your code by declaring reference types (also known as classes and interfaces) as members of other reference types and blocks. I also showed you how to use nesting to avoid name con…

No Image

Packages and static imports in Java

12 5 月, 2020 Jeff Friesen 0

In my previous Java 101 tutorial, you learned how to better organize your code by declaring reference types (also known as classes and interfaces) as members of other reference types and blocks. I also showed you how to use nesting to avoid name con…