5 Library Classes
String, Math, Random
String, Math, Random
Section 4: Java Methods and Library Classes
Lesson 3: The String Class
Lesson 4: The Random Class
Lesson 5: The Math Class
Section 4 Quiz 2 (Lessons 3-5)
Working with the String Class
Format Strings using escape sequences including %d, %n, and %s
Working with the Random and Math Classes
Use the Random class
Use the Math class
Tutorials Point
Math class (for absolute value, rounding, rounding down (floor), rounding up (ceiling), and more)
Udemy
Bucky's Room
Math Class Methods (4:50)
Random Number Generator (5:14)
Java Documentation:
String formatting
// %d decimal number
// %n line break
// %s a string
System.out.format("the %s jumped %n over the %s, %d times %n", "cow", "moon", 2);
Random
// create random object, only do this once
Random randomGen = new Random();
// get next int value, you can do this as many times as you want
// nextInt will return an int between 0 (inclusive) and the specified value (exclusive)
System.out.println("Next int value: " + randomGen.nextInt(10000));
Quiz and Concepts Review
String class
Precision
StringBuilder
Random class
Math class
abs
floor
ceil
pow
GitHub Project - Kanban