|
SESSION 6 Part5 |
Basics of how to write |
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
Next, let's take a look at the
'basics'
of how to write code,
while checking
the process details
written in the main function.
We will only be using the
contents of
the main function
block in this session.
Take care not to tamper with the
other parts. |
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
 |
 |
 |
|
|
|
|
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
What is written in the main function
this time is
System.out.println("Hello world!");
on line 20.
This is the process to display the
message in the standard
output. |
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
"Hello world!"was
displayed
because
of this command,
right?
|
|
|
 |
 |
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
 |
It's so simple with
just a single line! |
|
|
|
|
 |
What was it?
API = library?
Process = command?
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
That's right, this will run by invoking the command
println(),which is in the standard Java API.
By the way, it will automatically created a
new line after
displaying the text
There is also the
command print(),which doesn't create a new
line.
If you use this, you can display any text you like
in the standard output.
All you have to do is change the text inside the
"
(double quotes) brackets
to another character string.
With Java,
you need to write any character string data
that will be displayed on the screen inside
" brackets.
Let's do something to test it.
Change the "Hello world!" part to
whatever text you like, and then try running it.
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|
I tried changing it to
Japanese…
But in the end, English
is better.
Because it's my first
commemorative attempt. |
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
Oh, for real!
The message changed!
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
In other words, by using the standard API,
you can easily display things,even without
creating your own process.
It's fine for now if just copy it and use it
as is,
even if you don't understand what
it means.
We will be using this command many times
after this,so please remember it. |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
 |
thank you,
thank you
BUTA-ARARE |
|
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
Let's bring together the
basics of
how to write a
Java program by referencing
this process.
There are common rules for
how to write.
|
|
|
 |
 |
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
 |
 |
|
Like punctuation marks
and stuff? |
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
Yes, things like the rules when writing a program,
the
structure, and the way of calling things.
Look at the image on the board. Let's look at the basics.
*
Definition
*
Block
*
Statement
*
Indent
There's also all sorts of other things, but we'll look at
those
when the time comes.
Now, let's look at the details one by one.
|
|
|
|
|
|
 |
 |
|
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|