Course details

Defensive Programming in Java: Fundamentals

Defensive Programming in Java: Fundamentals

Target Audience
Expected Duration
Lesson Objectives
Course Number
Expertise Level

Defensive programming is an approach to programming that attempts to ensure that software still functions under adverse or unforeseen circumstances. In this course, you will explore the fundamentals of defensive programming in Java including how to use assertions and annotation, and how to use classes, types, methods, and program flow control securely. You will also learn how to handle exceptions correctly, how to manage resources, and how to terminate a program securely.

Target Audience
Java developers seeking an introductory guide to developing efficient, secure, Java applications that are defendable against a variety of issues


Expected Duration (hours)

Lesson Objectives

Defensive Programming in Java: Fundamentals

  • start the course
  • recognize the key features of defensive coding in Java
  • use assertions in your Java programming code
  • use annotations in Java programming code
  • create examples of defensible methods in Java
  • identify and apply defensive techniques for handling untrusted method parameters
  • apply secure checks on method return values
  • identify issues with conversions to narrower types in Java and identify issues with promotions such as long to double
  • identify issues with floating point values
  • recognize what integer overflow is and how to prevent it
  • identify issues with arithmetic operations in Java programs
  • identify issues with forming strings containing partial characters from variable-width encodings
  • identify issues with encoding noncharacter data as a string
  • identify issues with using strings to compare locale-dependent data
  • identify how to use null values in creating defendable code
  • identify how to work with classes to create defendable code
  • identify how to work defensively with constructors in Java
  • identify issues with mutability in Java classes
  • identify how to work defensively with serialization and deserialization in Java
  • identify the difference between abstract object and reference equality in Java programs
  • identify how to use conditional expressions when coding defensively
  • identify how to avoid assignments in conditional expression for defensive programming in Java
  • identify how to distinguish and use bitwise and logical operators in conditional expressions
  • use best practices in working with enhanced for poop in Java programs
  • identify how to use collections safely in Java programs
  • demonstrate how to use exceptions appropriately in Java to handle errors
  • identify how denial-of-service or DoS attacks can occur
  • identify how to manage resources safely in Java
  • identify how to correctly terminate Java programs
  • use defensive programming techniques in Java programs
  • Course Number:

    Expertise Level