Java/C2/Introduction-to-Array/Gujarati

From Script | Spoken-Tutorial
Revision as of 11:50, 8 August 2013 by Krupali (Talk | contribs)

Jump to: navigation, search


Time Narration
00:02 જાવામાં Array ના પરિચય પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00:07 આ ટ્યુટોરીયલમાં આપણે શીખીશું, એરે કેવી રીતે બનાવવું અને એરે માં એલીમેન્ટો કેવી રીતે એક્સેસ કરવું.
00:14 આ ટ્યુટોરીયલ માટે આપણે
  • Ubuntu 11.10
  • JDK 1.6 અને
  • Eclipse 3.7.0 નો ઉપયોગ કરી રહ્યા છીએ.
00:25 આ ટ્યુટોરીયલ અનુસરવા માટે, તમને જાવામાં ડેટા ટાઇપ અને for લુપ વિષે જ્ઞાન હોવું જરૂરી છે.
00:32 જો નહિં, તો સંબંધિત ટ્યુટોરિયલ્સ માટે અમારી વેબસાઇટ http://spoken-tutorial.org/ જુઓ.
00:38 એરે એ ડેટાનો સંગ્રહ છે.
00:40 ઉદાહરણ તરીકે, ગુણોની યાદી, નામો ની યાદી, તાપમાનની યાદી, વરસાદ ની યાદી,
00:47 દરેક આઈટમને તેના સ્થાન પર આધારિત ઇન્ડેક્સ છે.
00:52 પ્રથમ એલિમેન્ટનું ઇન્ડેક્સ 0 હોય છે.
00:55 બીજા એલિમેન્ટનું ઇન્ડેક્સ 1 હોય છે અને એ પ્રમાણે.
00:59 હવે ચાલો જોઈએ આ ડેટા કેવી રીતે સંગ્રહવા.
01:03 Eclipse ઉપર જાઓ.
01:06 ArraysDemo નામનો ક્લાસ પહેલાથી જ બનેલ છે.
01:11 મેઈન મેથડ અંદર ચાલો વરસાદના ડેટા ઉમેરીએ.
01:16 તો મેઈન મેથડ અંદર, ટાઇપ કરો,
01:18 int rainfall ઓપન અને ક્લોસ કૌંસ, ઇકવલ ટુ કર્લી કૌંસ અંદર ટાઇપ કરો, 25, 31, 29, 13, 27, 35, 12 અને અંતે સેમીકોલન.
01:53 rainfall નામના વેરિયેબલ નામ પછીના ચોરસ કૌંસની નોંધ લો.
01:58 rainfall, integers ના અરે તરીકે જાહેર કરે છે.
02:03 કૌંસ એરે ના એલીમેન્ટો સ્પષ્ટ કરવા માટે વપરાય છે.
02:09 ચાલો હવે ડેટા એક્સેસ કરીએ.
02:12 તો, નવી લાઈન ઉપર, ટાઇપ કરો,
02:14 System dot out dot println rainfall , ચોરસ કૌંસમાં 2 ટાઇપ કરો.
02:28 આપણે ઇન્ડેક્સ નમ્બર 2 સાથે એલિમેન્ટ પ્રિન્ટ કરીએ છીએ.
02:32 બીજા શબ્દોમાં, અરેમાં ત્રીજું એલિમેન્ટ જે 29 છે.
02:38 ચાલો પ્રોગ્રામ સેવ અને રન કરીએ.
02:43 આપણે જોઈ શકીએ છીએ, આઉટપુટ ત્રીજું એલિમેન્ટ છે. જે 29 છે.
02:49 હવે 2 ના સ્થાન ઉપર 0 ટાઇપ કરો.
02:56 પ્રોગ્રામ સેવ અને રન કરીએ.
03:00 આપણે જોઈ શકીએ છીએ, આઉટપુટ પ્રથમ વેલ્યુ છે. જે 25 છે.
03:07 હવે ચાલો પ્રથમ આઈટમ ની વેલ્યુ સુધારીએ.
03:13 તો ટાઇપ કરો, rainfall [0] = 11;
03:27 હવે ચાલો તેની વેલ્યુ જોઈએ. તો પ્રોગ્રામ સેવ અને રન કરો.
03:34 આપણે જોઈ શકીએ છીએ, વેલ્યુ 11 થી બદલાઈ છે.
03:40 હવે શું થશે જો આપણે માત્ર અરેનું કદ જાણતા હોઈએ અને વેલ્યુઝ નહિ.
03:45 ચાલો જોઈએ આવા અરે કેવી રીતે બનાવવું.
03:49 મેઈન ફન્કશનમાંથી બધું રદ કરો અને ટાઇપ કરો,
03:57 int squares [] = new int [10];
04:19 આ સ્ટેટમેન્ટ 10 એલીમેન્ટો ધરાવતુ integer અરે બનાવે છે. એરેનું નામ squares છે.
04:30 હવે તેમાં અમુક વેલ્યુઝ ઉમેરીએ.
04:33 તો ટાઇપ કરો,


04:35 squares[0] = 1;
04:43 આગામી લાઈનમાં, squares[1] = 4;
04:53 આગામી લાઈનમાં,squares[2] = 9;
05:04 squares[3] = 16;
05:15 તો આપણે પ્રથમ ચાર નંબરના વર્ગ દાખલ કર્યા છે.
05:20 હવે એરે ના અન્ય એલીમેન્ટો વિશે શું. ચાલો જોઈએ તેઓ શું સમાવે છે.
05:26 તો આપણે અરેના છઠ્ઠા એલિમેન્ટને પ્રિન્ટ કરીશું.
05:30 ટાઇપ કરો, System.out.println(squares [5]);
05:56 પ્રોગ્રામ સેવ અને રન કરો. આપણે જોઈ શકીએ છીએ કે વેલ્યુ શૂન્ય છે.
06:05 કારણ કે જયારે આપણે integer નું અરે બનાવીએ છીએ, તો બધી વેલ્યુઝ 0 થી ઈનીશ્યલાઈઝ થાય છે.
06:11 તેવી જ રીતે ફ્લોટ્સના અરેની તમામ વેલ્યુઝ 0.0 થી ઈનીશ્યલાઈઝ હશે.
06:18 એરે માં દરેક વેલ્યુ લખવું લાંબી પ્રક્રિયા છે. તેના બદલે, આપણે લૂપનો ઉપયોગ કરીશું.
06:28 તો ટાઇપ કરો,


int n, x ;

for(x = 4; x < 10; x = x + 1){

n = x + 1;

squares [x] = n * n;

}


07:25 So We iterate over numbers from 4 to 9 and set the corresponding element in the array.


07:36 Now let us see the output.
07:38 As we can see, we are printing the value of sixth element in array SoSave and run.
07:52 We see the sixth element is now square of 6, which is 36.


07:57 In fact now we can set all the values inside the for loop.
08:03 Remove the lines that set the values manually and change 4 to 0


08:14 This way all the elements from index 0 to 9 are set to the corresponding squares.


08:21 We shall now see the value of the third element.


08:25 So change 5 to 2


08:30 Save and run


08:35 As we can see, the value of the third element has been set in the loop and it is 9.
08:42 This way, arrays can be created and used.
08:50 We have come to the end of this tutorial.
08:53 In this tutorial we have learnt
08:55 TO declare and initialize the array ,
08:58 And access element in an array
09:01 The assignment for this tutorial is,


09:04 Given an array of integers, find the sum of all the elements in the array.
09:10 To know more about the Spoken Tutorial project,
09:13 watch the video available at the following link.
09:19 It summarises the project.If you do not have good bandwidth, you can download and watch it.
09:26 The Spoken Tutorial Project Team. Conducts workshops using spoken tutorials and gives certificates for those who pass an online test.
09:34 For more details, please write to contact AT spoken HYPHEN tutorial DOT org.
09:40 Spoken Tutorial Project is a part of the Talk to a Teacher project.
09:44 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
09:50 More information on this Mission is available at spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro
09:57 This script has been contributed by TalentSprint.

This is Prathamesh Salunke signing off. Thanks for joining.



Contributors and Content Editors

Jyotisolanki, Krupali, PoojaMoolya