1/38
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
How is data represented on a computer?
All data is just numbers (bits 0’s and 1’s)
What is the type of a value?
what a piece of data represents
How does Java use types?
to store numeric values/ data
What are the rules Java uses to determine the types resulting from primitive operators?
Java automatically widens the narrower type then executes the expression.
Strongly Typed
every value in program has an unambiguous type
What are the differences between a value that is a primitive type and a value that is a non-primitive type?
Primitive type values are the data themselves
Non-primitive types reference memory location where the data is stored.
What is the purpose of a typecast?
convert data to different types
When are typecasts done automatically?
Typecasts are done automatically when going from a narrower to a wider type. This is called widening.
When must a typecast be explicit?
When going from a wider type to a narrower type. This is called narrowing.
When are typecasts illegal?
they violate the type compatibility rules (Ex: String to int)
How does a typecast affect a value of primitive type?
Typecasting temporarily changes the type of a value to the type casted
What is null?
a value that shows the object is referring to nothing
What is “short circuit evaluation“ and what operators use it?
Evaluation of a logical expression stops before a complete evaluation. (&& and ||)
What ways do a arithmetic on a computer differ from “real“ arithmetic
Errors will crop up due to the fixed size of the numeric data types
What are variables
A variable is a name given to a location in memory.
Difference between declaring and assigning a variable
Declaring creates a variable
Assigning assigns a value to an already created variable
Where can a variable be accessed?
Using expressions
How long does a variable exist
An instance variable exists as long as the class that it is in exists.
A local variable exists as long as the method that it is in also exists.
input parameters only exists until after the method that it is in is called.
What is the difference between static and non-static fields
Static variables are shared among all instances of a class
Non static variables are specific to that instance of a class
What is the difference between static and non-static methods
A static method is a class method and belongs to the class itself
non-static method is an instance method and belongs to each object that is generated from the class
What does public and private do
Public : can be accessed anywhere
Private: direct access only within this type
What does protected do
can be accessed by code in same folder or types that are protected
What does final do
means that the value, once set, will not change.
What are the parameters of a method and how do they work?
Takes input and utilizes them within methods
What is the return value?
values the function returns when it completes
method overloading
multiple methods/constructors of the same name as long as they have different inputs
method overriding
occurs when a subclass has the same method as the parent class
What is ‘this‘
refers to the current object in a method or constructor
What is super
refers to the superclass (parent) objects, used to call superclass methods
When is super() & this() used
super() can access the parent class constructor
this() can access current class constructor
What strategies should I use to test a method with a loop
JUnit, or creating tester methods
How do you create a string
String name = new String(“hello“) or String name = “hello“
How do you concatenate strings
Stringbuilder
What is a StringBuilder and when do we use it
Used when we want to modify a string without creating a new object
What can you change about a string after you create it
Nothing (String are immutatble)
What is an array
container object that holds a fixed number of values of a single type
How do you create an array
int intArray[] = new int[20];
benefits of a array
Very fast access to every elements and organizes data
Strictly Typed
It is an error to use a type with an operation not valid on that type