used extensively by business enterprises android apps games and if you learn java
you could land a job as a java developer. Entry-level java developers have an
average starting salary of 70 000 that's nothing to sneeze at so why not learn
java. A jdk is an acronym for java development kit it contains developers tools to
help us code as well as a jre a java runtime environment which contains a library
toolkits and our jvm which translates by code for us to machine code. All you need
to worry about is downloading a jdk and everything else will be included. We need a
unique name for this java project i will call this my first program and i will want
to configure the jre the java runtime environment and we downloaded that with the
jdk. When we compile this source code to bytecode we 're going to create a new file
that has the dot class file extension and with that bytecode file we can run that
and translate it using a jvm a java virtual machine.
This is our class mine is called main anything within the outer set of curly braces
belongs to the class and is contained within and within our class we have what is
called a main method our program wo n't run without this method because when we run
our code we begin by calling the main method so if we were to compile and run this
code you can do so by clicking the screenplay button. When i compile and run this
pay attention the output is one long line of text. After printing the first
statement our cursor does not move down to the next line in order to do so we could
use a print ln statement short for print line it 's as if we're hitting enter when
we finish outputting our text. An alternative to using a print line statement is
that we could stick with the standard print statement and at the end of our text
add an escape sequence for a new character. Anything preceding with a backslash is
the beginning of an escape sequence and there 's one of a multitude of characters
that could follow afterwards and depending on the character this has special
meaning for your compiler to do something specific now anything that is following
two forward slashes is beginning of a single line comment i could write this is a
comment and this line of text is going to be ignored by the compiler.
A shortcut would be to type system dot out then hold control space and your ide
will auto generate the rest of this print line statement for you. A trick on
zooming in or out is how to change the font color as well as the background color
of your console window so with spaces spaces do n't make much of a difference
within your code. A variable is a placeholder for a value and it behaves as the
value that it contains. If we're going to store a value within a variable we have
to list the data type of what we 're planning to store within that variable is it
going to be a number a word a boolean so we need to discuss data types. A float
data type can store a fractional number up to six to seven digits. A double has
more precision it uses eight bytes of memory and it can store up to 15 digits. In
comparison with a float this has less precision than a double. The last data type
is the string data type the size varies because these are reference data types.