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.
No comments:
Post a Comment