Tuesday, July 9, 2013

Java (beginner) language basics










































Java is almost the same as C++. The basic operators, data types are the same. The same loops, datas, operators. important differences

We can't write
bool a;
instead of bool we write boolean.
The others are the same except for System.out.print
There are also some difficulties in reading data , we will learn about it later.
one important difference is that we don't have to import(include) String class, it is a default class.


Monday, July 8, 2013

Java(beginner) our first java project.


First go to File->New->Java Project


Give it a name and click Finish.


Now a bit about Java. Java syntax is 99.9% alike C++. So if you now C++ you won't have difficulties in Java. Unlike C++ everything which will happen in Java will happen in classes. (For knowing what is class please go to C++ intermediate section).
Java is an interpreting language so you will see you syntax errors right away. Now add new class File->New class
Remember we had a main function in C++? Now , we will need to have a main statemnet in Java too. For that we need to define our class as a main class. THE MAIN CLASS MUST HAVE A NAME OF A YOUR PROJECT. THERE CAN BE ONLY 1 MAIN CLASS.




































In the area I marked black type in a name of your project. In the area I marked red put a tick  and click finish.

Our first program will be a "Hello Wolrd "program.









































Type in the code I typed in our main function. (System.out.println("HelloWorld!!!"):)
As you can see eclipse has a good code hinting system. When you put . symbol you get the hints. There is also another good advantage eclipse has. For example you forgot that you need to type the word system but you remember that it starts with the letter s. You just type the letter s and press ctrl+space and you will get all the possible things starting wit the letter s
Now on the left we can see the list of our projects.For running our project Right cick on our prject on the left then Run as->Java Application. The result will be shown in console.

IF YOU HAVE QUESTIONS LEAVE THEM IN COMMENTS, NO QUESTION WILL BE UNANSWERED.

Java (beginner) setting up the enviroment

First we need to set up the enviroment for Java. First you will need a java itself . It is called Java development kit. Go to this page

and find java suitable for you System and download. If you are searching in google and you came to a site where it says you have to pay DON'T BELIEVE IT< IT IS SURE A LIE, JAVA IS A FREE PROGRAM.
Download and install Java development kit. After that don't even try to find an launch the program, you won't be able to find it . You need to download a program which will let you code on Java. There are a few choices , I suggest eclipse. eclipse is also a free program. 
go to http://www.eclipse.org/downloads/packages/eclipse-standard-43/keplerr choose your system , download and install. Now your enviroment is ready. Open eclipse, choose a workspace. For creating new project go to File->New->Java Project . 

IF YOU HAVE QUESTIONS REFFERING TO SETTING UP THE ENVIROMENT LEAVE IN COMMENTS. NO QUESTION WILL STAY UNANSWERED.