Difference between revisions of "Java/C2/Hello-World-Program-in-Eclipse/English-timed"
From Script | Spoken-Tutorial
Sandhya.np14 (Talk | contribs) |
Sandhya.np14 (Talk | contribs) |
||
Line 120: | Line 120: | ||
|- | |- | ||
|03:43 | |03:43 | ||
− | |''' | + | |'''out.println'''. In brackets in quotes type: '''Hello World''' |
|- | |- |
Latest revision as of 22:44, 3 April 2015
Time | Narration |
00:01 | Welcome to the spoken tutorial on HelloWorld in Java using Eclipse. |
00:06 | In this tutorial, we are going to learn how to write a simple Hello World program in Java using Eclipse. |
00:13 | For this tutorial, we are using Eclipse 3.7.0 and Ubuntu 11.10. |
00:20 | To follow this tutorial, you must have Eclipse installed on your system. |
00:25 | And you must know how to create, save and run a file in Eclipse. |
00:30 | If not, for relevant tutorials, please visit our website as shown. |
00:36 | Here is a line of java code that prints the message Hello World. |
00:44 | Now, let us try it on Eclipse. |
00:46 | Press Alt, F2 and in the dialog box, type eclipse and hit Enter. |
00:56 | Click OK at the workspace and here we have the 'Eclipse IDE'. |
01:09 | Now, let us add a new project. |
01:12 | Click File, New and select Project . |
01:19 | In the list of projects, select Java Project and click Next. |
01:26 | In the project name, type DemoProject (please note that there is no space between Demo and Project, D & P are in capital letters). |
01:40 | Click Finish at the bottom right corner of the wizards. |
01:46 | DemoProject has been created. |
01:49 | Now, let us add a new class to the project. |
01:52 | Right click on the Project, New, select Class. |
01:59 | In the class name, type DemoProgram and in the method stubs select one that says public static void main. |
02:13 | Click Finish at the bottom right corner of the wizard. |
02:20 | We can see that the DemoProject has the source directory and a file called DemoProgram.Java. |
02:27 | This is because every class in Java has to be in its own file. Hence the class 'DemoProgram' can exist only in the file Demoprogram.java. |
02:40 | We can see that there is very little space for the editor and the view looks cluttered. Let us minimize the other portlets and here we have the editor . |
02:55 | Notice that this line begins with two slashes which means this line is the comment and has nothing to do with our code. |
03:05 | Let us remove this line. Similarly every thing that is in between slash Astrix (/*) and Astrix slash (*/) is also a comment. |
03:17 | So, let us remove this comment also. |
03:22 | And here we have the bare bones of the code. |
03:27 | Now let us add the print statement, System. |
03:35 | Notice that eclipse gives a list of all the possible completions. |
03:38 | For now, we are going to type the command manually; |
03:43 | out.println. In brackets in quotes type: Hello World |
03:56 | In java, every statement has to end with a semicolon. |
03:59 | So, let us add a semicolon. |
04:03 | Here, these are complete HelloWorld program in Java. |
04:06 | Press Ctrl + S to save. |
04:11 | Right click Run as, Java Application to run the code. |
04:19 | As we can see on the output console, the message Hello World has been printed. |
04:24 | Now, let us change the "World" to "Java". |
04:30 | Save it with Ctrl + S and run it. |
04:40 | As we can see, the message that is printed now is Hello Java. |
04:45 | Now let us understand what each part of code does? |
04:48 | The first line indicates that the class name is 'DemoProgram' and it's a Public class. |
04:55 | The second line indicates that this is the main method. In other words the method from which execution starts with java. |
05:04 | As we know, this is a print statement. |
05:07 | And here is how we write a Hello World program in Java. |
05:14 | This brings us to the end of the tutorial. |
05:17 | In this tutorial, we have learnt how to write a Hello World program in java and also what each part of code does in java code. |
05:27 | As an assignment for this tutorial- |
05:29 | create a java class by the name Greet, it should bring "Program Successful" when executed. |
05:37 | To know more about the spoken-tutorial project. |
05:39 | Watch the video available at the following link.[1] |
05:42 | It summarizes the Spoken Tutorial project. |
05:45 | If you do not have good bandwidth, you can download and watch it. |
05:51 | The Spoken Tutorial team: |
05:53 | Conducts workshops using spoken tutorials. |
05:55 | Gives certificates for those who pass an online test. |
05:59 | For more details, please write to contact@spoken-tutorial.org . |
06:05 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
06:09 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
06:14 | More information on this mission is available at spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro. |
06:19 | This tutorial has been contributed by TalentSprint. |
Contributors and Content Editors
Arya Ratish, Devraj, Gaurav, Kavita salve, Krupali, PoojaMoolya, Priyacst, Sandhya.np14, Sneha, Vasudeva ahitanal