Program Logic

Learning Unit 4

Library Methods

Library Methods

Learning Objectives

In addition to all previous competencies, upon completion of this unit, you should be able to:

Learning Activities

In this unit, you will learn about common library methods and the benefits of using them. You will learn strategies for accepting end-user input and validating the input to meet the requirements of the application. You will learn to safely convert String variables into numbers. The techniques learned in these chapters are fundamental techniques built into the programming language. You can use these techniques to create complex applications. Each link below takes you to a specific chapter within this unit.

“The will to win, the desire to succeed, the urge to reach your full potential... these are the keys that will unlock the door to personal excellence.” -Confucius
  1. Library Methods
    • What are Library Methods?
    • Using Library Methods
    • Java Library Methods
    • The Dot Operator
    • What You Learned
  2. Common String Methods
    • String.toLowerCase()
    • String.toUpperCase()
    • String.length()
    • String.substring()
    • String.contains()
    • Comparing Strings
    • What You Learned
  3. Common Number Methods
    • Parsing a String into a Number
    • Input Mismatch Exception
    • Math Library Methods
    • Math.random()
    • Math.round()
    • Math.min() and Math.max()
    • Comparing Numbers
    • What You Learned
  4. Common Print Methods
    • Requesting Information from the End-user
    • System.out.println()
    • System.out.print()
    • System.out.printf()
    • What You Learned
  5. Scanner Library Methods
    • The Scanner Class
    • Scanner Methods that Return a String
      • .next()
      • .nextLine()
    • Scanner Methods that Return a Number
      • .nextDouble()
      • .nextInt()
    • Scanner Methods that Return a Boolean
      • .hasNextDouble()
      • .hasNextInt()
    • End-user Input Validation
    • What You Learned