Welcome to the Spoken Tutorial on getting started with the First java program. In this tutorial we will learn To create a simple Java program. To compile the program. To run the program. and About the naming conventions followed in Java Here we are using Ubuntu version 11.10 and jdk 1.6 To follow this tutorial JDK 1.6 must be installed on your system. If not, for relevant tutorial please visit our website which is as shown. Alright now let us write our first Java program. For that you need a Terminal and you need a Text Editor. I am using gedit as my Text Editor In the text editor , we will first create the class HelloWorld. So type class HelloWorld. HelloWorld is the name of the class. And Open curly bracket. Enter and close curly bracket. The code between this two curly brackets will belong to the class HelloWorld Now save the file by clicking on Save icon at the top It is a good practice to save the file frequently. so Save As Dialog box appears. Browse the location where you want to save your file. Here, in the home directory i will create a folder. Let us name it Demo and press enter Then inside this folder we will save the file. In the Name text-box, type the name of the class. In Java, the name of the class and the file name should be same. Recall that we created class HelloWorld. So we will save the file as HelloWorld dot java Dot Java is the file extension given to the Java file. Then click on Save button. So the file is now saved. Inside the class, we write the main method. So type: public static void main parentheses inside parentheses String arg Square brackets Main functions marks the starting point of the program. We will describe public, static, void and String in a future tutorial. Then once again, open curly bracket. Press Enter and close curly bracket. The code between these two curly brackets will belong to the main method. We will now write a code to display a line on the Terminal. So inside main method typeSystem dot out dot println parentheses semi-colon This is the statement used to print a line. semi-colon is used to terminate a line. Now let us tell Java, what to print. So Within parentheses in double quotes type, My first java program exclamation mark. Let us Savethe file by clicking on Save icon. Let’s go to Terminal. Make sure that you are in the directory where you save your HelloWorld.java Remember that I am in my home directory. So type cd Space Demo and hit Enter ls, press Enter. We see HelloWorld.java file present in the Demo folder. Lets compile this file so type javac Space HelloWorld dot java and hit enter This compile the file that we have created. Alright now the file is compiled as we see no error. We can see HelloWorld.class file created. This file can run anywhere. That is, on any Operating System. We do not need java compiler as well. Hence, java is rightly described as “write once, run anywhere.” So After successful compilation, run the program using the command, java (This time no c) space HelloWorld (and no dot java extension) and hit Enter. You will get the output My first java program! So we have written our first java program.Let us go back to editor Now, remove the semi-colon which is at the end of the statement. Click on Save icon. Let us go back to the Terminal. Run the command javac HelloWorlddot java. The compiler gives an error. It says, a semi colon is expected on the fifth line. The up arrow points to the error statement. Let us go back to the Editor. In Java, all statements are terminated with semicolons. So go to the fifth line and add a semicolon. Click on the Save icon. It is necessary to save the file before compiling Let us go back to the Terminal. Compile the file using javac Hello World dot java. The file is successfully compiled as we see no errors. Now, run the program using the command java HelloWorld and . We see the output My first java program! This is how you handle errors in java. As the series progresses, we will learn more about the errors. We now see what are the naming conventions in java. * The class name should be in CamelCase. * Which means each new word begins with an upper case. * Example: class HelloWorld, class ChessGame. So, H of Hello and W of World are in uppercase. Similarly C and G of ChessGame respectively are in uppercase. The method name should be the mixed case. Which means that the first word should begin with a lower case. And all new words followed should begin with an upper case. Also the method name should be a verb. For Example: showString(), main(), goToHelp(). Here s of show is in lowercase while S of string is in uppercase The variable name should not begin with digits . We cannot use keywords for our class, method or variable name. For example: cannot use keywords like public, private, void, static and many more. So in this tutorial, we have learnt to write, compile and run a simple java program. We also saw the naming conventions followed in java. For self assessment write a simple java program to print Java file name and class name should be same. To know more about the Spoken Tutorial Project Watch the video available at  It summarises the Spoken Tutorial project If you do not have good bandwidth, you can download and watch it The Spoken Tutorial Project Team Conducts workshops using spoken tutorials Gives certificates to those who pass an online test For more details, please write to [email protected] Spoken Tutorial Project is a part of the Talk to a Teacher project It is supported by the National Mission on Education through ICT, MHRD, Government of India More information on this Mission is available at
 We have come to the end of this tutorial. Thanks for joining. This is Prathamesh Salunke signing off. Jai Hind.