U2L12 - input
This lesson drills what Trevor teaches in U2L12
Pre-requirements:
- You have performed each of previous drills to reach a top speed, and then repeated top speed 10x
- Follow this for all drills explainer
- Or this if you haven't even installed the drills yet installation
Summary of what is drilled
A Disciplined Approach? holds that these items should never again allow any confusion in your mind about this list of what Trevor covered in this lesson:
COVERED IN THE LESSON
- how to instantiate an object variable - the Scanner - using a constructor
- what is an instance of an object?
- a class is a blueprint of an object
- type is a blueprint
- instance is created as new with constructor
- a constructor can consume another object
- how to import an object type
- a package is a folder where you put code
- one can dot control space a package
- java.lang is imported everywhere so you do not have to import it specifically
- blah.wah.heh navigates through a package tree of heh under wah under blah
- imports are a way to not have to prefix blah.wah.heh everywhere
- import blah.wah.* imports every class (blueprint) in a package
- String userInput = scanner.next(); for a word
- String userInput = scanner.nextLine(); for a whole line of input
Instructor Administered Test
- Create a new project
- Create a new package
- Create a new class with a new
public static void main
method - take input and declare a String variable and assign the input to that variable
- print out "Here is what you said []" except with the input inside the square brackets