Transcripts
1. Jumpstart Java: Introduction: Welcome to my introductory
course to jumpstart your understanding of
computer programming using the Java
programming language. Designed this course to be
a bit more intuitive than the traditional textbook method that most of you may be used to. It's designed to be an easy, low stress way to get
you up encoding quickly. As a result, you're going
to see the fruits of your labor printed
immediately to the screen. We're gonna start with the primitive datatypes
that includes strings, doubles, Booleans, and integers. These primitive datatypes are central to every
programming language, so you'll be able to
utilize what you want here. If you decide to move on to another language like C-Sharp, we want to get up
and started quickly. So all you're going to need is a computer and an
Internet connection. So I really hope you guys will
join me in the next video.
2. Jumpstart Java: Lesson 1 Setup: Welcome to your
very first-class, more like a pre-class, because all we're gonna do
is talk about how to get started with coding and the environments that we're
going to be utilizing. I wanted to give you a very brief overview of the
most common environments. So you're going to be utilizing
for software development. And these are called IDEs or integrated development
environments, as you can see on the
screen right now, I have the most
common IDEs for Java. If you pay attention
to the very top, Eclipse and NetBeans
and IntelliJ. These three are out
of all of them, the three most common in
three most well used IDEs for Java development. With Intel J taking the
lion's share of that. These are very good
options if you want to get started with
software development, IDEs make your
coding a lot faster. They often give you suggestions. They also do error
checking for you. So if you make
spelling mistakes, often, IDEs will
be good for that. And they are very good at
helping you debug your code. You can do all of that from one developed from one environment. The other option you
have at your disposal is Microsoft's
Visual Studio Code. Include Visual Studio
code can be utilized for Java development,
C-sharp development, flutter development, pretty much any type of
development you can think of, Visual Studio Code
has got you covered. This is also very easy to use, pretty simple to
set up for all of these environments that
you have access to. It was just to view code and the standard IDE environments. All of these have free options. Of course, if you pay money, you're going to get more
bang for your buck and more and more powerful IDEs when you're developing
and debugging your code. However, we're not going
to use any of that. All I want you to do is open up a new tab in your browser. I want you to go in
and I want you to have an online Java compiler. As you can see, I've
typed that often. You will have a list of online compilers
available to you. I tend to use J Doodle the most is the one I
started with years ago. Other ones have since
come onto the scene. And it really doesn't
matter which one you use. They all pretty much
work in the same way. They have a screen right here where you
get into your code. Same thing here. You get into your
code into here. And you can run your code as well and get output.
Same thing here. We're going to run our code
and we're gonna be adding up some numbers and we should get 35 where we hit the
Execute button. All this is really good for, is for I use it a lot when I want to prototype something and you're not gonna
get any fancy outputs. Everything is limited to strings or words printed
out to a terminal. So all you need is a desktop and
Internet connection and you can get started
coding with Java. So I will see you
in the next lesson. Have a great day.
3. Jumpstart Java: Lesson 2 Integers: Welcome to your very
first video titled, everyone loves integer math. As you can see on your screen. They have given you
some example code, and we've already run
this example code and found the sum of X plus Y. However, what I'm going to do is I'm going to delete all this and we're going to start fresh. We're going to start doing
our math from the ground up. So as of right now I'm
gonna write integer, yes, my integer type. I'm going to give this
variable a name of my integer one because it's
using multiple integers. So I'm just call this
isn't very descriptive. And then we're gonna set it
equal to the number ten. You should get in
the habit of using descriptive names
with your variables. In the previous example, the variables were
labeled x and y. There's nothing wrong with
us in the face of it. However, you can have
multiple variables named x and y over the
course of your program. And as you proceed in
your development journey, your files are gonna get larger. So if your debugger
comes back and says there's a issue
with variable x. You may have increased
difficulty in finding out which variable
X they're talking about. However, if you have a
variable called flow control out any file
called flow control, If a pretty good idea of where
it along to fixture code. We're gonna go to integer. We're gonna call
this my integer. And we're gonna
call it too because it's our second integer, and we're gonna make it 25. Now we're gonna do
some integer math. First thing we're going to do is we're going to find the song. We're going to do some addition.
Addition is pretty easy. Ten plus 25 would give us 25. What I'm gonna do
is I'm going to create another integer
and we'll call it sum. I'm going to set that
equal to ten plus 25. But instead of
using ten plus 25, I'm going to use my integer
one plus my integer two. So let's go into one plus nine to make sure you spelled
everything correctly. Now we're going to print
this out to the screen. So we're gonna go system
dot out, dot, print, line. Inside these parentheses
are going to put the sum. This is the standard way
to print things out to the console in Java system. You want to output, you want to print
in this lane means that it's only going to print it on one line and then it's
gonna move to the next line. So that's why that's there. So we shouldn't get an
integer addition which is 35. That's exactly what we were expecting and that's
exactly what we got. Awesome. Let's move on. Let's do something more challenging as suppose
let's do some subtraction. So we're going to call, we're going to create
another variable called integer difference. This one is called is
of type integer, sorry. But we're gonna
set that equal to, we're gonna say my integer
one minus my teacher to. Inside our print line statement, we're gonna change that
variable to difference. And let's see what we get. We get negative 15, which is what we
were expecting So, so far, so good. Let's move on. Let's do some multiplication. Same thing, we're going to
create an integer type. We're going to call
this the product. We're going to set this
equal to my integer. Type is a skill
which you all have. Integer one times my integer. We're gonna go here
and we're gonna replace difference product. And ten times 25
should give us 250. That's hit Execute
and see what we get. 250. For those of
you who are not familiar with what this
asterisk here is for. If you can recall algebra. And some of you who was
highly traumatic experience. But in algebra, whenever
we did multiplication, the notation was always to F5. Two times five
would give me ten. So that is common notation, but in computer science
we put that dot with an asterisk and essentially means the same thing we're
doing multiplication. Now that we've done
some multiplication, Let's do some division. Integer. What is this called? Quotient, which is cool. Very specific mass
names, by the way. Same thing if you can recall
a little bit of algebra. We used to do this. However, algebra that
symbol change and it became two over five. So almost specifically five
over 25 divided by two. We're gonna use
that same slash to do division. Back to the code. We're going to divide. What do we got to stick
the bigger number, which is my integer two. We're going to divide that by as a slash by the
question mark where your keyboard or underneath the question mark your
keyboard and we're gonna divide that by my integer one. See what we get. Make sure you replace
it with quotient. By the way, I look, programming errors is fantastic, but the output is two. You may be wondering, why is the Alpha-2? Well, that has to do with the
type that we've utilized. The integer type can only
hold onto whole numbers. So that's positive whole numbers and negative whole numbers. It cannot hold onto any fraction values
or decimal values. Now that we've seen
division and we've seen some limitations
of the integer type. Let's move on to another
basic mathematical concept, at least in computer
science, is called modulus. But what I'm going
to do is I'm going to create a comment. Comments. You use the backslash key twice. I'm going to call this modulus. Comments help you structure
and organize your code. You can use the comments
to leave yourself notes about which portion
of your code does what. This is very useful for
you as an individual when you have to go back and
look over your cold. But it's also going to be important if you're gonna
be working on a team. First comment modulus. And inside here for the
creating other integer type, because that's all we're
focused on right now. And we're gonna
call this modulus. We're gonna set this equal to integer two is
the bigger one. Everybody use the
percent sign this time because that is
the operation for, that is the symbol for
the operation of module. We're going to put
my integer. Sorry. Don't forget, change the
inside of the brackets. Let's hit Execute and
see what happens. We got to five. Where the heck the
five come from. Again, this is all basic
math you've seen before. We have 25 on the inside
and ten on the outside. Ten goes into 252 times
two times ten is 20. We're going to subtract that. And we have five leftover, if you remember, five
is your remainder. That is where the number five view from it is the remainder. We've learned about comments, we've learned about variables. We've wanted to do
some basic operations including modulus. And we've also learned how to print our output
to the screen. That's it for now. I will see you in
the next lesson.
4. Jumpstart Java: Lesson 3 Strings: Well, welcome to
our next lesson. For this lesson, it's titled
the strings of thing. In our previous lesson, we got started with
integer datatypes. And for this one we're
gonna get started with the string that
it's, so let's go. As you see, I have my JD to one, I compile it, opened up and I've deleted all of the
information below. The main. We're gonna get started
with the string datatype. So we're going to start
real basic and we'll slow. Let me do the first time. I'm going to type in string
matrix treaties capitalized. We'll get to that later. But if you recall, we would have been integer. We didn't have to capitalize
integer when we typed in. But for string we do
have to capitalize. So that's what we're gonna do. The variable name we're going
to use as my first name. I'm gonna set that
equal to a string. Strings go inside
quotation marks. Going to put a double
quotation mark right here. I'm going to type
into my firstName, every Java statement, least. And so we go on. So that's where I'm gonna
put it right there. Put an, a, another
string datatype, but this will recall
my last name. And inside of these
quotation marks will go to put my last name. We're going to end
with a semicolon. That was real easy. But print something out to
the screen and you will get, when you do system dot
out, dot print line. For now, we're going
to print my first. We're going to hit Execute
and see what we get. And as you see, my firstName, print it out just fine.
My name is Donna. Let's change this to all capitals and see
what we get this time. You see it printed out again, but instead of using
standard grammar, capital L, festival, lowercase,
everything's uppercase. So that's the output we got when we create
it to the screen. We did some basic stuff. So now we're going to
move on to concatenation. Concatenation is when you're adding something
to something else. And the keyword there is Add. I'm going to create
a new variable. I'm going to call
it my full name. Sorry. I want to add together
firstName with my lesson. I'm gonna do that
well, first one would have been my first name. Since we're adding a loop
with that plus sign there. And what I'm going to
add to my last name, I'm to end with a semicolon. Then I'm going to print this out to the screen
and see what we get. So system out, print line and I'm going to print, we're going
to hit execute. There seems to be a problem. We print it out when Al Davis, but there's no space. The reason why is because this is what concatenation does. It takes something in, immediately appends it to
the end of something else. In this case, my last name, Davis, is immediately
appended to my first name. So I'm gonna change this
variable to my full name. And I'm going to create another
string variable called it my Lucy, my first. We're going to do catenate
it with something. What am I going to
decay? And it was wow, in my first name and
then I want to space so I don't put a space in. I'm going to use
quotation marks. And I'm going to
hit the spacebar. And that is how you add a
space in-between strings. Firstname, and then I'm going
to add onto that space, and then I have to add
onto that my last name. I'm going to print
out my full name to. Hopefully we should get a space in between my
first and last name. This is what we got. Fanout space Thetas. Now we move on to something fun. But before we talk about that, we have to talk about classes. When you go to the
Oracle documentation or any documentation, you're gonna see these
things called classes. Inside of a class. You have these things
called methods. This is the string class. That is the reason why we
had to capitalize this was because string is a class. It is not a primitive datatype. It holds data, but it's
not a primitive datatype. Integer was primitive
datatypes were there to hold small amounts of information because we
wrote limited in space. We've talked about. But right now we have a class
and we have a string class, and classes have
methods and methods. You can think of them as
the tell your object, your string escaping
to do something. How do we call those things? Well, let's look at it. First method, we're going
to call me scroll down, down, down, and we're
going to call it length. Well, what does the
length method do? It says it returns the
length of the string. I'm sorry, simple. Well,
let's just see it in action. Inside my system.out.print line. I have my full name, Lucy, my folding one. And then I'm gonna hit a dot. That dot says, I want
you to search through this class and I need you
to look for something. What do I want you to look for? I want you to look
for the method mites. Going back to our documentation, we can see that lines also
has these parentheses. So you'd have to make sure that anytime you call a method, you put those
parentheses next to it. This should, as the
documentation donors give us the length
of the string. In the length of the
string is how many characters are in it. Let's see. I have 123456, my first name, 12345, my last name. So
I should get you up. And that's exactly what we got. We got 11 because we have an L, Davis wouldn't know space. Well. Now we're going to use the
dot length method one, my folding two is since
we've added a space to it, you should already be able to guess what the length of
the string is going to be. But let's just see. And as you can see,
the length is one more than the previous one
because of that space. So the length is 12,
which is amazing. So now we're gonna move on
to a couple of functions. The two lower-class function, the two upper-class function and the content equals function. And try and guess to see
what each of those Thus, we're going to
take my firstName. Remember my firstName is
in all capital letters. We're going to call the
two lowercase method. Remember, because it's a method we need those parentheses. We should get my first name in all lowercase
letters. Let's see. That's exactly what we got. Everything is working
great so far. Well, since we have the
two lowercase method, There's also a
toUpperCase method. Let's see it that an action we're going to type
in my last name, dot upper case, and
again parentheses. To execute. We got the expected output. My last name, all
capital letters. So that's pretty cool. Method will be utilized. Maybe there's other
methods we discussed. Cotton equals cotton
equals constant equals, sounds exactly like what
it does, doesn't it? It takes the content and sees
if it's equal to something. What's happening is we're
going to take an a string. We're gonna compare
that string to another string to see
if they're the same. Well, I'm going to create system dot
out, dot, print line. Inside our parentheses. We're going to type something
just a little bit crazy. So we're gonna put
all of our skills together to create this output. Well, first thing
we're gonna do is we're going to type a string. The string we're
going to type as a question, does, sorry, Does my firstName, which is
the name of our variable, equal my last name? Question mark. I put a space there to
add some formatting to it so that it's a
little bit easier to read. We're gonna keep catenate or
add to that another string called the colon space. For formatting purposes. We're going to add onto that
some more interesting stuff. We're going to add on
to that, my firstName. On that firstName string, we're going to call the
method content equals. Again, remember,
when you have a, we'd call a method, you'd have to put
those parentheses. The one thing I
haven't gone over are the parentheses that we have
to attach to every function. What are they? Therefore, while the purpose of the parentheses is that it allows the function to take any value to do
some work with it. Just like we
discussed previously, the content eval
function takes in the string through
the parenthesis. And it's going to do
some work in this case, compare it to something else. I want to compare to
see if the content of my firstName equals the
cotton of my last name. I'm going to pass in
to those parentheses. My list. As you can see, my firstName does
not equal my last. So the answer to
this question should be false. See if it works. I'll put those my first name, my last name, The
answer is false. Well, let's change the variables a little bit to see what we get. So instead of now
with all capitals, just making my
lastname, firstname, but we're going to utilize
all lowercase inlets. See what the answer would
get is equal to no. False. And it doesn't, because
to a computer in capital L and lowercase l or two
very different things. So you'd have to keep that
in mind visually to us, it would be the same
whenever I wouldn't matter. But to the computer
those so let's change the first one to all lowercase
and see if they equal. There's my first
name, my last name. The answer is true yet
when l equals one l, exact same length, exactly
if doctors all lowercase. Well, we've done a little
bit of concatenation, play with some functions. That completes our
lesson on strings. I will see you in
our next lesson.
5. Jumpstart Java: Lesson 4 Booleans: Welcome to your next lesson titled Do you like
me? Yes or no? You don't have to
answer that question. What is the purpose of
a boolean primitive? Well, it's the whole,
the value true or false, yes or no, one or 0. How do we use them in
computer programming? Well, we use them to
help us make decisions. Simple example would be, is the interest rate going
to be greater than 5%? The answer is yes, then
we'll make more money. If the answer is no, then
we will make less money. On my screen, I have opened my J22 online Java compiler and we're going to get
started with some code. Easiest way to create a Boolean
variable is to just type in your Boolean variability. In my first Boolean. We're gonna set that
equal to false. Make sure you end
with a semicolon. And like we normally do, Let's see what we
get when we print that out to the terminal. We're just going to hit Execute. Where do we up this
name, my own variable. We get the answer false. Well, that was pretty easy. So let's do something more fun. When you erase this real quick. I'm going to create some comparison numbers is
what I'm gonna call him. So I put in a comment. I'm going to name my
variables simply. You're going to have to
forgive me a little bit. I am going to be lazy
in my variable names. I know I say you
shouldn't do it, but I also said that
it was possible. So since our code is pretty small, That's where
I'm going to do. Our first integer a is going to be set equal to the number 9. Second integer b is also going to be set
equal to the number 9. Third integer c will be set
equal to the number ten. Now we can start doing
some comparisons. I'm going to create
a Boolean variable. We're gonna call this
minus second Boolean. We're gonna set that
equal to something. Now, what we're gonna set it
equal to is a comparison. We're gonna compare one
of the two numbers above. I want to see if a equals B. So what I'm going to
do is I'm going to sit a double equals b. We have to talk about
the difference between the single equals
and the W equals. The single equals. We've
been utilizing a lot. It's basically there
for assignments. So we have integer type, variable name, money, and we assign it a
value of, let's say $9. The double equal sign
on the other hand, wants to see if things
are exactly the same. So if we have integer
variable type money, when we assigned to
the value of nine and we have an integer variable, my money, and we assign
it a value of ten. I can use the double
equals to see, well does tend
actually equal nine? If a and B are the same, we should get an output
which should say traditionalists type
system dot out dot print. And we're gonna
put in my second, we're going to hit Execute. We can see our value is true. So a does in fact equal b. Let's keep going. We're going to type in Booleans. My third in it, we're going to assign
that this comparison. In this case, I'm setting
it to see if the value, whoops, sorry, let's use our
integer c greater than b. I want to see if c
is greater than b. If you remember, the greater than sign tries
to eat the bigger number, I'm asking myself is
c greater than b? And when I put in
my third Boolean, we should get a value of
true, which it is true, C, which is ten, is greater than
B, which is nine. So let me change that around. Is b greater than c is
nine greater than ten? And the answer should be false. So that works out. It is useful. You can create and set variables equal to these types of comparisons
statements if you like. You can also do it directly. So what I'm gonna do is
I'm going to type in system dot out, dot print line. Inside these parentheses. I'm going to do a comparison. I'm going to ask it is
six greater than two. And the answer that is true. Our first one stated that our third Boolean wishes
false because ten is not greater than c. And the
second statement that we created is true six
is greater than two. I can also do the same thing. Is equal to six, is
not equal to two. That concludes our
lesson on Booleans. I will see you in
the next lesson.
6. Jumpstart Java: Lesson 5 Floats and Doubles: Welcome to our next lesson
called float. Float on. What is the purpose of
a float or a double? Well, we looked at integers, but they can only hold
onto whole values. So we need something
to hold onto something that is either
a fraction or a decimal. And that's what floats
and doubles do. Well, what's the difference? The primary difference
is that a float has 32 bits of space, while a double has
64 bits of space. Why is that important? Short answer specificity. For example, if we take
the number 1 third for those of you who remember
math for a long time ago, we know that that is a repeating decimal
and we're going to get a never ending
amount of threes, right? However, if we have to do calculations with that
particular number, it would do us good
to make sure that we are as specific as possible since we can't hold
onto infinity. In this case, we
would use something like a double because it's a bigger datatype and it can hold onto more of
those decimal spaces. I restarted our online
G2 to compiler. And as you can see, we have the default code
that they have given us. So we're going to
play around with this default cold a
little bit just to see some of the differences
and limitations of doubles. The first thing I wanted
to do is I'm going to convert this z value, which finds the sum of x and y. I'm going to convert
it to a double. And we're going to print out the results,
see what we get. All it does is it takes
that 35 that we got, which is a whole number and
it adds on a 0 because we're dealing with a value that can hold on and
deal with decimals. So we convert it for, you know, what I'm gonna do
is I'm going to convert that Z back to an int. We're going to convert
the X2 double. We're gonna go over
the y to a double. We're going to put
on zeros for effect. And let's look at our output. We got an error. It says possible lossy conversion
from a double to an int. Well, what does that mean? Well, recall how we talked about the walls
and how we use them for specificity because
they can hold onto lots of decimal places. Well, what we're
effectively trying to do is take this number with
lots of decimal places, this large number
of the computer. We're trying to stuff
into a box that only allows you to hold
onto one number, exactly one number with
no decimal spaces. So that's why we're
getting this error. I'm going to delete the
zeros and see what happens. Same thing because our datatype is a double and it requires, or it's for highly
specific numbers. When doing a conversion from
a double to an integer, the compiler just won't let you. Now that we understand
some of our limitations. Just make up some variables and see what we
can do with them. I'm going to create a double. And we're going to call
this my first double. We're going to set
this equal to three. Remember, just because we put a whole number
into a double, is going to convert
it and add on that 0. Let's create our other doubles. Double. Second, double. Want to say that you go to 2.5. You're going to have
to double my third. We're going to assign that
the value that's 2.5, assignments the value of 9.83. I have all my double
variables created. What can we do with them? We can do pretty much the same
thing we have been doing. We can take them,
we can add them, we can multiply them. So let's do system
that L dot print line. Unless let's take my first. Let's add that to
my second double. Let's see what we get out. You'll be at 12.83. You can do that in the
traditional way that we've learned how to do when we
were working with integers. There is another way to do it. And in this case, I'm going to call on, I'm going to use
the double class inside our parentheses
and a double. In sum. Now remember, we have
different colors. One is capitalized, one is not. Lowercase means that
it is primitive. Capital means we're dealing
with the Double class. And when we're dealing
with the class, we can call on the functions. And one of the functions of
the double class is some. So instead of adding
those things together, like we did previously, we can just put them into this, into the parentheses and let the function do the work for us. So my first double into there, comma, my second double. We're going to hit
Execute and we should get the
exact same number. We get 12.83. Well, what else can
the double class do? Let's go to system. Dot out dot print line. We're going to
double-click this again, but this time we're
going to call max. I'm pretty sure you can guess. What Max does. Max should find
the maximum value between the two values
that we've given it. Between the first and
the second double, we should output second
one, which it does. The max values between the values that we've
given it as 9.83. Let's do something else. Let's go to system dot
out, dot print, mine. Inside here we're going to
use the dopant class again. We're going to call
the Min function. What are we going to give it? We're going to give
them my first level. You're gonna give
it my third double. These days I'm going to
get better at typing. For the third line
or third output, we should get the minimum
value between the two. Execute. Always remember your
variables correctly. We see that we got
a value of 2.5. What about floats? Floats hold onto
decimals to utilize them a little bit of
a catch with float. So let's just go through
the code a little bit. As you can see, I have my
code already written out. I have commented out the code
that I don't want to run. And I have set float
equal to pi first float, and we're going to execute
and we should get 3, which is very similar to what happened when we
were using double. So let's uncomment and
delete these back slashes. And as I said, full tree to hold onto decimal. So we should get 3 here in
3.0001 for the second one. Doesn't quite work, does it? Java is making some assumptions. The assumption is since you're
using a decimal number, you're going to
assign it to a double because doubles more
precise however, you want to use a float
value because you don't need that
level of precision. For Java, it looks like
you're trying to take this more precise
number called a double and fit it or
jam it into a smaller, less precise number
called a float. Same thing like we tried
to do when we convert it. We tried to push it to
the integer datatype. Very simple fix. When you want to use a float, because you need to use float. You put an F at the
end of your number. When we add Execute. Everything works perfectly. So that's the primary difference between floats and doubles when you're utilizing
them in code. If you want to see what
else doubles Can Do, you feel free to utilize the Oracle documentation to look at the double class to see what are the functions
you can call. But those are some of
the most common ones that you're likely
going to use foresee. That concludes our lesson
on floats and doubles. I will see you in
the next lesson.
7. Jumpstart Java: Lesson 6 Misc Primitives: Welcome to your final lesson
in this particular course. And today we're going
to discuss some of the lesser known unless you're
used primitive datatypes. We have already talked
about integers and strings. We've talked about
Boolean values, and we've talked about
floats and doubles. But we haven't talked about are the lesser known data types. And that's are the bytes. Longs, shorts, and chart. The reason we haven't talked about these datatypes
until this point is because you're likely not going to use them when
you're running your code. I'm not going to show you any
coding examples with them, but it is important to know that they do exist and
why they exist. So let's talk about a
little bit of history. In the beginning,
there was Java. Well, actually in the beginning
there were computers and computers in the late
18th and early 90s. In particular, when a lot of these programming
languages were created, did not hold a lot of data, did not have a lot
of space available. And when I say space, I'm talking about space
in terms of memory. Memory is where the computer takes the instructions
that you give it, veer your code and execute
on those instructions. When you have a limited
amount of memory or limited, limited amount of
space to utilize, you have to be very conservative
in how you code and what types of data you use. As you can see based off of this advertisement that I
fell off for the early 90s, a standard computer with an Intel 100 processors,
a long time ago. A standard computer game
with eight megabytes of RAM, very eight megabytes of RAM, or eight megabytes of memory. And the maximum it can
hold a was 64 megabytes. So shocking. In today's world,
you are looking at 16 gigabytes of memory
being your standards. So that should give you an
idea of how far we've come as far as memory goes.
In programming. Back then, it was fine and graphic displays
for a minimal, most displayed values to the screen weren't
necessarily images but text. So eight megabytes of RAM
would have in Fine Back then. What is a byte? A byte is eight bits. And we've all seen these
ones and zeros before. 123456788 of these bits
together constitute a bite. What do bites do by
total and two values from negative 128
to positive 127. And this is very similar to what we were looking at
when we were talking about integers versus
Fulton versus doubles. Integers hold onto
whole number values of a certain amount. And Fulton doubles hold
onto decimal values. But even among
floats and doubles, full total on to
32 bits of data, or they take up 32 bits
of space in memory, while the whole stick up 64
bits of space in memory. So as we move on, we move on to shorten. As you can see, a
short is basically two bytes and they hold onto 16 bits of space, the memory. And it's very specific
for numbers of negative 30 to 7068
to positive 32,767. Moving on, we have a long, a long hold onto 64 bits of data and takes
up 64 bits of space. And a long can hold
onto a number that has a negative line
preceded by 18 spaces, or 18 zeros, and a up to a positive nine
followed by 18 spaces. And just to give you an idea of how big of a number that is, this is one trillion. One trillion is a one
followed by 123412. Zeros are 12 spaces, so long can hold onto quite large and
quite small numbers. The final thing we're going
to talk about is char. Char is for a single character in a single character only. So for example, the
letter W In English. You can use that to hold
onto. You can use charter. Hold on to the letter W. You cannot use char to
hold onto a Word. You can. If you don't want to hold
onto just a single character, you can also hold onto what
we call a Unicode value. Unicode is the standard way
for computers to display texts and emojis to the screen. Let's look at an example here. As you can see, this is
the Unicode homepage. Every language on Earth, every character for every
language on Earth has its own associated
Unicode value so that we can display it
as text onto the screen. If you've ever seen
those text-based emojis, what they're often doing
is taking characters from other languages and putting them together so they
look like an image. And then they take their
associated Unicode values to display the image
to the screen. But it's really just
a series of texts, values that you're seeing
when you see those images. As you can see here, we also have some emojis
that you can display with Unicode that does
it for this course. This is the final
lesson in this course. I hope you learned something
and had a good time and at least feel powerful when
you go coding right now, feel confident in
musical coding. The next video that I'm
going to discuss with you is about your mini
capstone project. And I'm just going to be going through the problem sets and just doing a quick run through of them so
that you can get started practicing
with your coding. And I hope you've had a good
time and I will see you in the next lesson and I hope you
have a wonderful day. Bye.
8. Jumpstart Java: Capstone: Alright, I'm going to go through the mini capstone project. You're going to want to open up the Word document that I
have attached to the course. The reason why I've chosen a Word document and not in
another format like PDF is because the Word document kept the formatting of the questions. Open up your document. And all you're going to want
to do is hit Control or Command a to select. All. You're going to hit Control
or Command C to copy. You're going to want
to go to any browser. You're gonna want to type
in online Java compiler. Press Enter, open up the
compiler of your choice. Wait for your compiler to load. You're going to your workspace. You're going to want
to hit Control or Command a to select all again, Delete or Backspace, and
then Control or Command V. To paste everything
into your workspace. You're going to want to
delete everything right here. These were just
instructions that I had in the document for
individuals who may not have watched this video. Central Washington. Just go ahead and delete it. Got to clean that
up a little bit. And this is the
capstone project. As you can see, it's literally just 12 questions that you have the answer and you're just
going to want to go in order. Question one says make this variable statement
into a comment. So you're going to want
to make sure you take this statement and turn it into a comments or that
it turns green? Question two, you're gonna
complete the following. So the spaces you're just
going on and replace them with whatever words were letters you need to replace them with
to make it make sense. Question three says, print your name to the
terminal screen. So you're going to want to, after you figure out what
this is supposed to be, you're going to
need to use this to solve this particular problem. And when you figure that out, you're just going to want
to come down here to hit Execute in your name, should print out to the screen. Question for concatenate
or add this free. So the previous answer hello, My name is, for example, hello, my name is Bob Smith. You're going to want to print
that out to the screen, put that here and hit Execute, and you should get
your result down here. Continuing on, five Marry has seven
lambs Mickey variable, and assign it a value based
on the number of forelimbs. Would you choose a double
float string or integer? Make it variable. What type are you going
to use an assign it a value based off
of the question, Question six, using the previous variable
from areas lambs, how would you print? Mary has seven lamps to
the terminal screen below. So it's a combination of
using the answers from like 345 in order to
solve question six. Question seven,
Janice has $6.07. Treat a variable and
assign it a value based on the amount of
money that Janice has. So what variable
you're going to use? What type of variable should you use to hold the value of $6.07? Question eight is where things become a little
bit more difficult and challenging and we sought to apply everything that we've
learned in this course. Question eight, you can answer the questions right
inside of this comment, right next to each
question, you could just write down your answer. You don't have to hit
Execute or anything. But it's really just
designed to get you thinking through the scenario and how to set up variables and what
type of variables you use and how to combine
everything so that you can create your own
little mini program. Question eight or mill has nine toys and what
like three more? Answer the following questions. How many total toys will he
have with the answer here? What mathematical operation
did you use to find this answer for his
initial nine toys? Which variable name is best? This one or this one. What variable name
will you use to represent the three toys
he would like to add? So you get to decide what
variable name you should use to represent the three
additional toys you want. What variable name would you use to represent the
total number of toys? Again, you get to decide
what that variable is. You can put that here. What datatype is most
appropriate for these variables. So based off of the
numbers that we have here, what datatype would be best? And then how would you print the results to the
terminal screen using a sentence
silver male would have x number of
toys, for example. Again, you can just put
your answer right here. Again. You put your answer
next to the questions. They should all be green
and you should not be able to execute because they'll
essentially be comments. But after doing Question eight, he should have enough skill to figure out questions 91012. For problems 91012,
we're going to create the correct variable names and correct datatypes
to retain our data. We're going to use those
variables to perform the correct
mathematical operation. And then we're going to print the results of the
terminal screen, usually a standard sentence. So Rebecca has five students and once each student to have
eight pieces of candy, how many pieces while
she needs to have? So now you have to
look at your numbers. What types of numbers are they? What variable names
will you use? What mathematical operation will you use to find the answer and then how you go to print all of that information to the screen. So Rebecca will need extra
pieces of candy, for example. Same thing. Josh has 37 apples and wants to divide them evenly
amongst seven people. How many apples will
he have leftover? The key phrase being leftover. So what operation that we use to represent remaining values? Question 11, what is the value of Pi to
six decimal places? You can look that up and
place the answer here. When assigning values
which datatype would be best used for the
previous answer again, put your answer here. Then for question 12, You're gonna take
what you did in question 11 and use it
to answer this question. The question says
the area of a circle is pi times radius times radius. If the radius of a
circle of seven, what is the area of the
circle to six decimal places? As you can see, this is all
pretty much straightforward. Every question built
upon the last one. This is really designed
to get you thinking, to get you some practical
experience and some repetition using the concepts that we've learned in the previous lessons. I hope you all have
enjoyed this course. I hope you all have learned
something from this course. And I sincerely hope you
all have a wonderful day.