Variables Explained
Follow along with the instructions at: https://fullstackclouddeveloper.com/c...
Java is a strongly typed language and it provides built-in primitive types to use as building blocks to create other types. As an object oriented language an unlimited number of reference types are possible and Java has several useful reference types built-in.
Primitive Types
Primitive types represent the basic building blocks needed to create other classes. The primitive types are listed below and we will experiment with each to describe them.
int
long
double
float
boolean
byte
short
char
int
Reference Types
Strings
Dates
Arrays
Lists
Maps
Exercise 3: Print Variable Values
For this exercise, take our Hello, World! application and,
Primitives
Print out a variable value of each primitive type,
Check the minimum and maximum values of type Long and print them out
Strings
Create a String sentence and assign it to a variable then,
Print out the sentence .length(),
Replace the third word in the sentence with a different word and print out the sentence,
Split the sentence into an array of its words,
Print out the array of words,
Print out the fourth word in the sentence
Dates
Create a new Date and assign it to a variable that represents right now,
Print out the date variable,
Get the month for the date variable
Lists
Create an ArrayList variable of type Integer,
Add 5 numbers to the list in random order,
Use the Collections class to sort the list,
Print out the list to see the new sorted order
Maps
Create a Map with String keys and String values,
Add names as keys and addresses as values to create an address book,
Print out the map to see the address book,
Print out the .size() of the map to see how many addresses are in the book,
Get an address for one of the names in the map,
Print out the address
Auf dieser Seite können Sie das Online-Video Java Crash Course: Variables Explained mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer FullStackCloudDeveloper 15 Juli 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,246 Mal angesehen und es wurde von 16 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!