Hello guys today is the continuos of our Java programming tutorials let us stay in touch till the end.
As we did earlier we installed java SDK on our computers so
as we can run java codes on them also we installed IntelliJ where we can write
java codes through it.
So today we are going to start with HELLO WORLD PROGRAM we are going to write hello world with java
syntax (Java language). Play careful Java programming language is a case
sensitive language so watch out
Before we write the line code there are things to note in
Java we have a class, a method, and a function
A class it’s
where the method and function stay take an example of your classroom its
where teacher and students stay write that’s the same as a class in java
language.
A method its where
a function is located always remember a function must stay inside of a method
it’s also like an exercise book you will never have your writings on air they
must stay on an exercise book or paper then that’s a method.
A function the
codes are written here so as to perform a specific task according to the codes
written as the word defines it function hence we input functions for the
program to perform. Now here is where your hands get dirty. It’s where
programmers test their skills, anyway everything its easy no need of freaking
out.
Simply we have this syntax on java language
public class
Helloworld{
public static void
main (String[] args){
System.out.println(“HELLO
WORLD”); //prints hello world on the screen.
}
}
It might sound crazy but that’s java don’t you worry we have
a video elaborating in case you won’t understand. Okay java has a lot of codes
meaning you must write a lot for a simple thing but why don’t you enjoy it's
easy, let we move to the meaning of the codes
STARTING ON THE CLASS.
public means the
class is public it can be referenced on somewhere else just understand that for
now not to complicate things.
class, it’s
a word that shows the line of code it’s a class and nothing else.
Helloworld is the
name of the class you can put anything else but programmers like specifying the name of the class to the function for quick remembering.
THE METHOD PART
public means that
the method is public hence it can be called anywhere else.
static meaning
that the method does not change it is simple as the English word keeps that for
now also you will understand more as we continue.
Void it simply
mean that there is no something to return hence through the name void we mean
nothing is returned through the method.
Main is a method
type that is understood by the computer that is the main method.
(String[] args) these are parameters they are written inside the brackets we will describe them
later.
THE FUNCTION PART
System.out.println make
this as a single word for quick understand the word system we specified that
the computer or any device running the java code should take out(the code
word) print it means it should be printed on screen ln means a line
Okay let we now join
the words system.out.println the device should print a line on screen we had
the brackets remember with quotations (“HELLO WORLD”). SO hello world will be
printed on to the screen.
Let I clarify something not to mislead you the // symbol
means a comment is never executed on the code.
LINK FOR THE VIDEO:
Today also we will learn about String don’t get exhausted
it’s the last part for today and I will provide a link to the video that will
clarify today's concept
STRING
STRING is an object representing a sequence of characters. Examples of a string can be your
name, your city, your country name.
Java.lang.string is a class used for the string but there is no
much need of concentrating on that for now
REMEMBER: String
are always written in quotation marks “STRING
GOES HERE” once you place anything inside the marks they are regarded as a
string in java language.
EXAMPLE OF A CODE
public class String_class{
public static
void main (String[] args){
String
name = “MOODY”;
System.out.println(“MY
NAME IS” + name);
}
}
// this will print MY
NAME IS MOODY on the screen.
Well I have already explained about the codes up there good
I think you do remember.
Here are some that I didn’t explain.
String is the
type of data I mentioned earlier
name meaning the
string name that we referenced to the System.out.println
= meaning string name equals to MOODY (REMEMBER THE ; SYMBOL)
+ means that the word printed on the screen will be added up with the string
LINK FOR THE VIDEO:
Comments
Post a Comment