Difference between revisions of "Java/C2/First-Java-Program/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 54: Line 54:
 
|-
 
|-
 
|01:01
 
|01:01
| '''Text editor''' માં, 'લખાણ સંપાદક''', આપણે પ્રથમ '''HelloWorld''' ક્લાસ બનાવીશું.
+
| '''Text editor''' માં, આપણે પ્રથમ '''HelloWorld''' ક્લાસ બનાવીશું.
  
 
|-
 
|-

Revision as of 13:01, 17 July 2013

Time' Narration
00:02 First java program પરના આ સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00:09 આ ટ્યુટોરીયલ માં આપણે શીખીશું,
00:11 સિમ્પલ જાવા પ્રોગ્રામ બનાવવું,
00:14 પ્રોગ્રામ કમ્પાઈલ કરવું,
00:16 પ્રોગ્રામ રન કરવું અને
00:19 જાવામાં અનુસરવામાં આવતા નેમીંગ કન્વેન્શનો વિષે
00:24 અહીં આપણે ઉબુન્ટુ આવૃત્તિ 11.10 અને જાવા ડેવલપમેન્ટ એન્વાયર્નમેન્ટ jdk 1.6 નો ઉપયોગ કરી રહ્યા છીએ.
00:32 આ ટ્યુટોરીયલ અનુસરવા માટે JDK 1.6 તમારી સિસ્ટમ પર સંસ્થાપિત હોવું જોઈએ.
00:39 જો નહિં, તો સંબંધિત ટ્યુટોરીયલ માટે નીચે બતાવેલ અમારી વેબસાઇટ જુઓ.
00:46 હવે ચાલો આપણો પ્રથમ જાવા પ્રોગ્રામ લખીએ.
00:51 તે માટે તમને Terminal અને Text Editor ની જરૂર છે.
00:56 હું Text Editor તરીકે gedit નો ઉપયોગ કરી રહ્યી છું.
01:01 Text editor માં, આપણે પ્રથમ HelloWorld ક્લાસ બનાવીશું.
01:06 તો ટાઇપ કરો, class HelloWorld. HelloWorld એ ક્લાસનું નામ છે.
01:17 કર્લી કૌંસ ખોલો. Enter ડબાઓ અને કર્લી કૌંસ બંધ કરો.
01:24 આ બે કર્લી કૌંસ વચ્ચેનો કોડ HelloWorld ક્લાસનો છે.
01:33 હવે ટોચ પર Save ચિહ્ન પર ક્લિક કરી ફાઇલ સેવ કરો
01:37 ફાઈલ વારંવાર સંગ્રહ્વી સારી વાત છે.
01:43 soSave As Dialog box appears.
01:46 Browse the location where you want to save your file.
01:51 Here, in the home directory i will create a folder.
01:57 Let us name it Demo , press enter
02:02 Then inside this folder we will save the file.
02:08 In the Name text-box, type the name of the class.
02:13 In java, the name of the class and the file name should be same.
02:20 Recall that we created class HelloWorld.


02:25 So we will save the file as HelloWorld dot java
02:33 Dot java is the file extension given to the java file.
02:39 Then click on Save button. So the file is now saved.
02:47 Inside the class, we write the main method.


02:53 So type:
02:54 public static void main parentheses inside parentheses String arg Square brackets


03:10 Main functions marks the starting point of the program.


03:15 We will describe public, static, void and String arg in a future tutorial.


03:23 Then once again, open curly bracket.
03:27 Press Enter and close curly bracket.



03:32 The code between these two curly brackets will belong to the main method.
03:41 We will now write a code to display a line on the Terminal.


03:46 So inside main method typeSystem dot out dot println parentheses semi-colon


03:59 This is the statement used to print a line. semi-colon is used to terminate a line.


04:10 Now let us tell Java, what to print.


04:13 So Within parentheses in double quotes type, My first java program exclamation mark.
04:30 Let us Save the file by clicking on Save icon.
04:36 Let's go to Terminal.
04:38 Make sure that you are in the directory where you save your HelloWorld.java


04:46 Remember that I am in my home directory.


04:50 So type cd Space Demo and hit Enter


04:59 We see HelloWorld.java file present in the Demo folder.
05:06 Lets compile this file so type javac Space HelloWorld dot java and hit enter


05:21 This compile the file that we have created.
05:25 Alright now the file is compiled as we see no error.
05:30 We can see HelloWorld.class file created.
05:36 This file can run anywhere.
05:38 That is, on any Operating System.
05:41 We do not need java compiler as well.
05:45 Hence, java is rightly described as “write once, run anywhere.”


05:51 So After successful compilation, run the program using the command,
05:56 java (no c) space HelloWorld (no dot java) extension and hit Enter.
06:07 You will get the output My first java program!
06:13 So we have written our first java program.Let us go back to editor


06:22 Now, remove the semi-colon which is at the end of the statement.
06:27 Click on Save icon.
06:29 Let us go back to the Terminal.
06:33 Run the command javac HelloWorld dot java.
06:41 The compiler gives an error.
06:44 It says, a semi colon is expected on the fifth line.


06:52 The up arrow points to the error statement.
06:57 Let us go back to the Editor.
07:01 In Java, all statements are terminated with semicolons.
07:06 So go to the fifth line and add a semicolon.


07:13 Click on the Save icon. It is necessary to save the file before compiling
07:22 Let us go back to the Terminal.
07:25 Compile the file using javac Space HelloWorld dot java.
07:32 The file is successfully compiled as we see no errors.
07:36 Now, run the program using the command java HelloWorld and .


07:45 We see the output My first java program!
07:49 This is how you handle errors in java.
07:54 As the series progresses, we will learn more about the errors.
08:02 We now see what are the naming conventions in java.
08:06 * class name should be in CamelCase.
08:10 * Which means each new word begins with an upper case.
08:14 * Example: class HelloWorld, class ChessGame.
08:19 So, H of hello and W of World are in uppercase.


08:25 Similarly C and G of Chess and Game respectively are in uppercase.
08:31 The method name should be the mixed case.
08:35 Which means that the first word should begin with a lower case.
08:39 And all new words followed should begin with an upper case.
08:44 Also the method name should be a verb.


08:48 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 .
09:06 We cannot use keywords for our class, method or variable name.
09:13 For example: cannot use keywords like public, private, void, static and many more.


09:22 So in this tutorial, we have learnt to write, compile and run a simple java program.
09:30 We also saw the naming conventions followed in java.
09:35 For self assessment write a simple java program to prints Java file name and class name should be same.


09:47 To know more about the Spoken Tutorial Project
09:50 Watch the video available at http://spoken-tutorial.org/What_is_a_Spoken_Tutorial
09:58 It summarises the Spoken Tutorial project
10:02 If you do not have good bandwidth, you can download and watch it
10:08 The Spoken Tutorial Project Team
10:10 Conducts workshops using spoken tutorials
10:13 Gives certificates for those who pass an online test
10:17 For more details, please write to contact@spoken-tutorial.org


10:25 Spoken Tutorial Project is a part of the Talk to a Teacher project
10:30 It is supported by the National Mission on Education through ICT, MHRD, Government of India
10:38 More information on this Mission is available at
http://spoken-tutorial.org/NMEICT-Intro 


10:49 We have come to the end of this tutorial.
10:51 Thanks for joining.
10:53 This is Prathamesh Salunke signing off. Jai Hind.

Contributors and Content Editors

Krupali, Pratik kamble