In this tutorial you will learn:
1. Setting up the Programming Environment
2. Setting up IDE
3. Basic JAVA Overview
4. Basic JAVA console Program
Before starting coding you need to first setup the environment for coding. For that first go to Google and download JAVA development kit (JDK). Using this link.
After downloading you simply need to install the JDK. To check if JDK has been installed you simply need to open CMD by first opening RUN (windows+r) and then typing CMD. In CMD you simply need to write Java then press ENTER. If you see some output then you are on the right track do the same step by writing Javac if you see some output then JDK has been successfully installed.
After installing JDK simply download ECLIPSE using this link
Download Eclipse IDE for JAVA Devlopers
Now open eclipse and create your workspace and you are good to go.
Basic JAVA Overview:
The first thing that you need to learn are the basic data types which are same in java like in other programming languages.
• Data types:
1. Int stands for integer e.g int x =5;
2. Float stands for float e.g int y = 4.5;
3. Char stands for char e.g int c = ‘m’;
4. Double stands for double e.g double d = 4.222233
5. String stands for Strings e.g String s = “MyJAVA”;
• Class, Object and Methods
These are 3 basic things that you need to learn in order to learn any object oriented language and Java is an object oriented programming language.
What is a class and what are its attributes and methods?
A set or category of things having some property or attribute in common and differentiated from others by kind, type, or quality.
A class contains attributes, methods and a main function (optional)
Student is a class Student_name, age, id will be its attributes and
getData(), getAge(), setAge() will be its methods
Now Student s1 this will be an object of the student class. Each object will have specific attributes and methods.
Basic Java console program:
Open Eclipse > Workspace
File > new > java project
File > new > class (Name it MyJava)
Write the following program
Note: The name of your public class should be the same as your class name.
First thing you need is the import statement which will include many of java functions in your program. You can read more about java.util in oracle documentation. Write the main method as is for now you will understand more about it when we will study methods. Now inside the main is where you will write all your code. Any code here will be the output of your program.
Println(“”); is a function which can print any string you pass inside it.Which in this case is simply Hello JAVA.
We will learn more coding from next tutorials.
If you have any questions or want to learn programming from me simply add me on Skype
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.