Java language basics Flashcards
Data types specify….
specify the kind of thing a value represents
Variables are….
used to store values for later use. must have a specified data type
Arrays are….
used to store multiple values in a single variable which all must be the same data type
Conditional Statements allow…..
Allow for branching and looping in Java
entry point for the program to begin
main method - every java program must have one
main method syntax
public static void main (String[] args) {
//code goes here
}
Class names should be _________ case?
PascalCase
One of the Class names much match the?
filename.java
Sequence Diagrams show…..
show how application components or separate applications interact with each other and in the order of interactions.
Sequence Diagrams are structured…..
are structured to represent a timeline beginning at the top and descending to depict the sequence of interactions.
Class diagrams are used…..
are used to describe classes and their relationships
Class diagrams show….
the names and attributes of the classes, relationships between the classes, and sometimes also the methods of the classes.
What do the plus and minus signs indicate in this class diagram
+ before the attribute name means the attribute is public
- means the attribute is private so it is not visible to outside sources
What do the words following the colons represent
In a class diagram this item when following attributes, it’s the data type for the attribute. When following methods, it’s the return type for the methods.
What is the class name?
Person
What data type does setName return?
None the void means it doesn’t return anything
What are the items below the second line?
This row of the diagram is a section containing the Constructors and Methods. Constructors are listed first and then methods.
What are the items at the top of this sequence diagram
the customer object who is outside our diagram and the theater and server objects inside our diagram
What is the vertical dashed line?
A lifeline that represents the different objects or parts that interact over time.
What are the solid horizontal lines?
Messages being sent between objects
What are the dashed horizontal lines?
Direct response messages that are the return for a message that was sent.
What is the vertical rectangles/activation boxes in some sequence diagrams?
The Activation box is present under the object next to the code for each process which the object is involved.
what is casting?
The conversion of one data type to another
what is the memory size order from smallest to biggest of these data types:
int
float
byte
double
long
short
byte < short < int < long < float < double
what is the syntax for casting a larger data type (float) into a smaller(int) (Narrowing Casting)
float floatVar = 45.67
int intVar = int(floatVar)
What is the size and range of values of a byte?
byte | 8-bit | -128 to 127
What is the size and range of values of a short?
short | 16-bit | -32,768 to 32,767
What is the size and range of values of a int?
int | 16-bit | -2 billion to 2 billion
What is the size and range of values of a long?
long | 32-bit| -9 quintillion to 9 quintillion
What is the size and range of values of a float?
float | 32-bit | 6 decimal digits
What is the size and range of values of a double?
double | 64-bit | 15 decimal digits