Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,356 members, 7,780,957 topics. Date: Friday, 29 March 2024 at 06:22 AM

Java Tutorial: Beginner's Guild - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Java Tutorial: Beginner's Guild (3178 Views)

Which Programming Language Should A Beginner Start With? / How Would You Like A Java Tutorial Video In Pidgin / Get Web Programming, C++, Java Tutorial Tutorial Videos. (2) (3) (4)

(1) (2) (Reply) (Go Down)

Java Tutorial: Beginner's Guild by Jas80: 8:47am On Jan 02, 2020
First of all, a happy new year to everyone out there, wishing you a prosperous year in all you do.

Actually am a new member here, literally, I just opened my account this morning, but I have been a guest on this forum for 5-6 years now.....by the way, you can call me Jas.

I am opening up this trend for any individual out there who wants to learn programming, so each and everyone of you is welcomed. If you want to learn programming, be it Android app development, game development, web design, then you are in the right place.

For all the aforementioned programming concept, Java is a front runner. Maybe that is the reason why it is the most popular programming language wink.

You can use Java for almost anything, ranging from game development to web design. So,if you know you have been thinking of learning programming, this is the perfect time for it.

So just type "I am in", to lemme know if u really serious about this.

Happy New year once again, let us start it with productivity wink.bye for now

1 Like

Re: Java Tutorial: Beginner's Guild by blujoi(m): 12:01pm On Jan 02, 2020
I am in
Re: Java Tutorial: Beginner's Guild by Dreamer0909: 3:09pm On Jan 03, 2020
I'm also in.
Re: Java Tutorial: Beginner's Guild by eche45(m): 3:25pm On Jan 03, 2020
I
Dy
Game
Re: Java Tutorial: Beginner's Guild by erul: 12:31am On Jan 04, 2020
I Am in
Re: Java Tutorial: Beginner's Guild by DestinyGodwin: 8:21pm On Jan 04, 2020
Re: Java Tutorial: Beginner's Guild by Jas80: 9:27pm On Jan 04, 2020
Good evening everyone, so our tutorial is starting today. lets begin....
INTRODUCTION
Java is the most popular language used by programmers. Luckily for you, that's the language you are learning today.

First, of all i believe, you all know what a compiler is, for those of you who don't know, a compiler is a program, we use in compiling our codes, so that the computer can get what we are telling it to code. As beginners, we are going to we our going to write out codes(what we want the computer to do) using notepad and we are going to compile our codes using command prompt.

GETTING STARTED
Before we can starting running java programs on our system, we need to install it first. So, visit www.java.com to download it(That is if you don't have java on your machine).

After installing it, open your Notepad and type this code on it:
public class HelloJava{
public static void main (String [] args){

System.out.println( "I am learning java" );
}
}

Then save the file name as HelloJava.java. Next thing is you open your command prompt, and go to the directory you save the file.
For example if you saved the file on your documents, you simply type cd documents on your command prompt then press enter.
Then type javac.Hellojava.java and press enter, type java HelloJava and press enter.

Your output will be : I am learning java

You may get this error when you are compiling your program “javac’ is not recognized as an internal or external command, operable program or batch file“. This error occurs when the java path is not set in your system.

If you get this error then you first need to set the path before compilation.
Set Path in Windows:(I believe you are all using windows wink)
Step 1: Go to Computer properties
Step 2:Click on advance System settings
Step 3:Click on environment variables
Step 4:Click on new tab of user variables
Step 5: Assign value PATH to variable name
Step 6: Copy the path of the bin folder( go to the directory were your java is, and copy the address of the java bin folder)
Step 7: Paste path of the bin folder in variable value
Step 8: Click OK button
Step 9:Click OK button

NOTE that java is case sensitive, so type everything the way u see it(public,static,main, void, args, all begin with lowercase, while System and String begins with uppercase). Also note that the file name should be same as the class name, and should begin with an uppercase, each word making up the class name should begin with an uppercase.
FEEL FREE TO ASK ANY QUESTION

1 Like

Re: Java Tutorial: Beginner's Guild by Jas80: 12:17pm On Jan 05, 2020
Happy Sunday everyone, so let me talk about coding apps,.....when I was in school I really wanted to code apps(I studied computer science). I can remember d first day my Java lecturer came to class, I was really so happy, I thought to myself "finally I am going to code application". So, my lecturer went to the board and wrote a code to print hello world. I couldn't run d code because I wasn't with my laptop. So, I rush home type d code and compiled it, only to see "hello world" displayed on my cmd. I was so disappointed. Cos I was expecting an application. My lecturer didn't explain things clearly to me. So, I carried out my research and understand what he did. He was simply showing us the syntax of java.

You see, java have different API(Application programming interface), the type of API you use depends on the type of application u want to create. In other to use these API to build ur application, u need to learn the basics of the programming language. This is were basic programs like hello world are useful. So don't be disappointed with output of the codes for now. After learning these basics, will introduce you to the AWT and Swing API..........ask anything, am here

2 Likes

Re: Java Tutorial: Beginner's Guild by Xcecutive: 2:45pm On Jan 05, 2020
I am capital letter IN

Bro don't give up
Re: Java Tutorial: Beginner's Guild by Jas80: 2:59pm On Jan 05, 2020
Xcecutive:
I am capital letter IN

Bro don't give up

That's d spirit....have u installed Java on ur system

1 Like

Re: Java Tutorial: Beginner's Guild by Nobody: 7:34pm On Jan 05, 2020
I am in
Re: Java Tutorial: Beginner's Guild by Jas80: 7:35pm On Jan 05, 2020
operationmoses:
I am in


Follow the steps above to run your first program
Re: Java Tutorial: Beginner's Guild by Jas80: 8:18pm On Jan 05, 2020
Good evening all, hope u had a nice day, down to business.

Explanation of the example


Every line of code that runs in Java must be inside a class.


In our example, we named the class HelloJava. A class should always start with an uppercase first letter(I already told you).


The name of every java file you are saving must match the class name. When saving the file, save it using the class name and add ".java" to the end of the filename.

The main Method

The main() method is required in every program you are going to write, you will see as we go on:

public static void main(String[] args)-----------this is what is known as a method, so it will be present in all our programs.

Any code inside the main() method will be executed. You don't have to understand the keywords before and after main. You will understand them as we go on.

System.out.println()-------------this is another method
We use this method, to print text in our programs.

A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. Think of a method as a small program inside our main program.

Each method has its own name. When that name is encountered in a program, the execution of the program branches to the body of that method. When the method is finished, execution returns to the area of the program code from which it was called, and the program continues on to the next line of code.

Methods can be built in or user defined. So, the main method and the System.out.println method are built in method. You will understand as we go on
.


Note: The curly braces {} marks the beginning and the end of a block of code.

Note: Each code statement must end with a semicolon.

3 Likes

Re: Java Tutorial: Beginner's Guild by Nobody: 10:16am On Jan 06, 2020
blujoi:
I am in
U recently sent me an email regarding the job posting regarding finding English teachers. Do send me your WhatsApp Num for easy back and forth communication

1 Like

Re: Java Tutorial: Beginner's Guild by Xcecutive: 3:21pm On Jan 07, 2020
Jas80:
Happy Sunday everyone, so let me talk about coding apps,.....when I was in school I really wanted to code apps(I studied computer science). I can remember d first day my Java lecturer came to class, I was really so happy, I thought to myself "finally I am going to code application". So, my lecturer went to the board and wrote a code to print hello world. I couldn't run d code because I wasn't with my laptop. So, I rush home type d code and compiled it, only to see "hello world" displayed on my cmd. I was so disappointed. Cos I was expecting an application. My lecturer didn't explain things clearly to me. So, I carried out my research and understand what he did. He was simply showing us the syntax of java.

You see, java have different API(Application programming interface), the type of API you use depends on the type of application u want to create. In other to use these API to build ur application, u need to learn the basics of the programming language. This is were basic programs like hello world are useful. So don't be disappointed with output of the codes for now. After learning these basics, will introduce you to the AWT and Swing API..........ask anything, am here


Wow... I am currently in this face.... Thanks for the elaboration bro... More grease cheesy
Re: Java Tutorial: Beginner's Guild by Xcecutive: 3:25pm On Jan 07, 2020
Jas80 update sir... It is always good to learn from different perspectives. And I love your style smiley

1 Like

Re: Java Tutorial: Beginner's Guild by Jas80: 3:41pm On Jan 07, 2020
Xcecutive:
Jas80 update sir... It is always good to learn from different perspectives. And I love your style smiley

Thanks bro.....was thinking of stopping the tutorial since there are no followings.....have things to do

1 Like

Re: Java Tutorial: Beginner's Guild by LaiveNg: 4:21pm On Jan 07, 2020
This thread is a life saver...
Following 100%
Re: Java Tutorial: Beginner's Guild by Sirkastiq(m): 5:03pm On Jan 07, 2020
I can give u a tutorial guide on how to create an android application in Java or can u do that for us jas80

1 Like

Re: Java Tutorial: Beginner's Guild by blujoi(m): 6:50pm On Jan 08, 2020
Alright, please check your email

Odogu9195:

U recently sent me an email regarding the job posting regarding finding English teachers. Do send me your WhatsApp Num for easy back and forth communication
Re: Java Tutorial: Beginner's Guild by MyChoice1: 7:11pm On Jan 12, 2020
Jas80:


Thanks bro.....was thinking of stopping the tutorial since there are no followings.....have things to do

Pls don't stop. I'm following

1 Like

Re: Java Tutorial: Beginner's Guild by Xcecutive: 6:24am On Jan 13, 2020
Jas80 bro... Don't do this to us o... We are gaining alot here. Please update. I am following you already.
Re: Java Tutorial: Beginner's Guild by Excallibur(m): 8:30am On Jan 13, 2020
Just found this thread, bro please keep it up
Re: Java Tutorial: Beginner's Guild by Jas80: 9:35pm On Jan 13, 2020
Hello everyone, due to the message I got from 2 or 3 persons following dis thread, I have decided to continue with it..... So, if u know u haven't try the codes above, try them and gv me ur feedbacks

1 Like

Re: Java Tutorial: Beginner's Guild by Xcecutive: 11:54pm On Jan 13, 2020
Jas80:
Hello everyone, due to the message I got from 2 or 3 persons following dis thread, I have decided to continue with it..... So, if u know u haven't try the codes above, try them and gv me ur feedbacks
..

Thanks bro
Re: Java Tutorial: Beginner's Guild by LaiveNg: 3:49pm On Jan 15, 2020
Jas80...
We're desperately waiting to tap more from your wealth of knowledge bro.

1 Like

Re: Java Tutorial: Beginner's Guild by aremuforlife(m): 12:09am On Jan 16, 2020
[/quote][quote author=Jas80 post=85772154]Hello everyone, due to the message I got from 2 or 3 persons following dis thread, I have decided to continue with it..... So, if u know u haven't try the codes above, try them and gv me ur feedbacks
Please you need to continue

1 Like

Re: Java Tutorial: Beginner's Guild by Nobody: 1:22am On Jan 16, 2020
I am in

1 Like

Re: Java Tutorial: Beginner's Guild by Jas80: 3:39pm On Jan 17, 2020
Good afternoon everyone, so lets continue from were we stop.

LETS TALK ABOUT VARIABLES IN JAVA
Now, when developing an app, there are things known as variables. Variables refer to the name we give to something in our app, which will hold a value. Lets take for example, a bucket, a bucket holds water, which we can use to bath, drink, or wash e.t.c. This bucket helps us to store our water, so we can use it anytime we choose to. The same thing goes with variables, they help us to store data, or information we would like to use in our app. Lets take for example.
int a=50;
int b=20;
int c=a+b;
In the above, we have given the value 50 to the variable a to hold for us. So whenever we need the value 50 in our program, we can ask a to provide it for us. Same goes with the variable b which holds 20 for us, and c which gives us the sum of a and b. You will understand more as we go on.
JAVA DATA TYPES
In computer, we all know what data is. In programming, there are several types of data. Data can be a decimal number, a whole number, a character, a word, or even group of words. As you can see in our java variable example, before declaring our variable, there is a word "int" before our variables. Now "int" is a data type used for declaring whole numbers. Note that all our variables must be assigned a data type. The data type we assign depends on the value of our variables.
There are 2 types of data types namely:
1. Primitive data types:
This is the basic data types, they include int, double, Boolean,char, short, long, float,
2. Non-primitive data types:
These data types are more complex than the primitive data types. They include Strings, classes, interfaces and arrays.
We will learn about only the primitive data types for now.
Primitive data type
We have about 8 primitive data types. As listed earlier, they include
• Int data type
• Double
• Short
• Long
• Float
• Byte
• Char
• Boolean

As beginners, let us just know the basics of the aforementioned data types.
Int data type: We use this data type when we are working with whole numbers like 1,20,5,6, e,t.c.
Double data type: We use this data type when we are working with decimal numbers
Float data type: This data type is just like the double data type

You will understand the other data types as we go on

3 Likes

Re: Java Tutorial: Beginner's Guild by Jas80: 3:45pm On Jan 17, 2020
ARITHMETIC OPERATORS
I guessed you all already know what an operator is. Arithmetic operators refers to our usual mathematics operators. They include +,-,*,/,%.
We use this operators in our programs to perform operations on our variables.
Let's take a look at the program below.

public class Add{
public static void main (String [] args){

int a =4;
int b= 6;
int c =a + b;
System.out.println(c);
}
}

The output of the program will be 10, because we added two operands a and b,.....hope you dig?

2 Likes

Re: Java Tutorial: Beginner's Guild by Nobody: 10:00pm On Jan 17, 2020
Instructor pls can I have your phone number
Re: Java Tutorial: Beginner's Guild by Xcecutive: 8:13am On Jan 18, 2020
Jas80:
ARITHMETIC OPERATORS
I guessed you all already know what an operator is. Arithmetic operators refers to our usual mathematics operators. They include +,-,*,/,%.
We use this operators in our programs to perform operations on our variables.
Let's take a look at the program below.

public class Add{
public static void main (String [] args){

int a =4;
int b= 6;
int c =a + b;
System.out.println(c);
}
}

The output of the program will be 10, because we added two operands a and b,.....hope you dig?

Good morning bro... I am very much enjoying your method of teaching... More grease sir... We'll be waiting for the next update.. thanks

1 Like

(1) (2) (Reply)

Node Js Gurus @nswer This Biko / Why Is C++ So Hard? / Sign Your Online Documents With This App

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 78
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.