Difference between revisions of "Java/C2/Strings/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 8: Line 8:
 
|-
 
|-
 
|  00:05
 
|  00:05
|  In this tutorial, you will learn how to  
+
|  In this tutorial, you will learn how to:
  
 
|-
 
|-
 
|  00:08
 
|  00:08
| '''create strings''', '''add strings''' and ''''perform basic string operations''' like converting to lower case and upper case.'''
+
| '''create strings''', '''add strings''' and perform '''basic string operations''' like converting to lower case and upper case.
  
 
|-
 
|-
 
|  00:18
 
|  00:18
| For this tutorial we are using  
+
| For this tutorial, we are using  
  
 
'''Ubuntu 11.10''', JDK 1.6''' and  
 
'''Ubuntu 11.10''', JDK 1.6''' and  
Line 24: Line 24:
 
|-
 
|-
 
|  00:26
 
|  00:26
|   To follow this tutorial you  must have knowledge of '''data types in Java.'''
+
| To follow this tutorial, you  must have the knowledge of '''data types''' in Java.
 
+
  
 
|-
 
|-
 
|  00:32
 
|  00:32
| If not, for relevant tutorial please visit our website as shown
+
| If not, for relevant tutorials, please visit our website as shown.
  
 
|-
 
|-
 
| 00:40  
 
| 00:40  
|  '''String''' in Java, is a sequence of characters.
+
|  '''String''' in Java, is a sequence of '''characters'''.
 
+
  
 
|-
 
|-
 
|  00:44
 
|  00:44
| Before starting with '''Strings, '''we will first see the character data type.
+
| Before starting with '''Strings,''' we will first see the '''character''' data type.
 
+
  
 
|-
 
|-
 
|  00:50
 
|  00:50
| Let us now switch to eclipse
+
| Let us now switch to '''eclipse'''.
  
 
|-
 
|-
 
|00:55   
 
|00:55   
|  we have the eclipse IDE and the skeleton required for the rest of the code.
+
|  we have the 'Eclipse IDE' and the skeleton required for the rest of the code.
 
+
  
 
|-
 
|-
 
|  01:00
 
|  01:00
| We have created a class  '''StringDemo '''and added the main method.
+
| We have created a class  '''StringDemo''' and added the '''main method'''.
  
 
|-
 
|-
 
|  01:07
 
|  01:07
|  Inside the '''main''' method, type '''''char star '''equal to in single''' '''quotes''' asrteicks '''''
+
|  Inside the '''main method''', type: '''char star ''' equal to in single quotes  asterisks. 
 
|-
 
|-
 
|01:19
 
|01:19
| This statement creates a variable with name '''star '''and of the type '''char.'''  
+
| This statement creates a variable with name '''star''' and of the type '''char.'''  
 
+
  
 
|-
 
|-
 
|  01:25
 
|  01:25
 
| It can store exactly one character.
 
| It can store exactly one character.
 
  
 
|-
 
|-
Line 73: Line 67:
 
|-
 
|-
 
| 01:33
 
| 01:33
| Remove the char line and type  ,
+
|Remove the '''char''' line and type:    
  
 
|-
 
|-
 
|  01:36
 
|  01:36
| '''char c1 '''''equal to in single quotes''''' c'''
+
| '''char c1''' equal to in single quotes 'c'
  
 
|-
 
|-
 
|  01:43
 
|  01:43
| '''char c2 '''''equal to  in single quotes''''' a'''
+
| '''char c2''' equal to  in single quotes 'a'
  
 
|-
 
|-
 
|  01:49
 
|  01:49
| '''char c3 '''''equal to  in single quotes''' ''r'''
+
| '''char c3''' equal to  in single quotes 'r'
  
 
|-
 
|-
 
|  01:55
 
|  01:55
 
| We have created three characters to make the word '''car'''.
 
| We have created three characters to make the word '''car'''.
 
  
 
|-
 
|-
Line 98: Line 91:
 
|-
 
|-
 
|  02:02
 
|  02:02
|   type,
+
| Type:
 
+
  
 
|-
 
|-
Line 112: Line 104:
 
|  02:22
 
|  02:22
 
| '''System.out.print(c3);'''
 
| '''System.out.print(c3);'''
 
  
 
|-
 
|-
 
|  02:31
 
|  02:31
 
| Please note that I’m using '''print''' instead of '''println''' so that all the characters are printed on the same line.
 
| Please note that I’m using '''print''' instead of '''println''' so that all the characters are printed on the same line.
 
  
 
|-
 
|-
 
|  02:39
 
|  02:39
| save the file and  run it.
+
| '''save''' the file and  '''run''' it.
 
+
  
 
|-
 
|-
 
|  02:43
 
|  02:43
 
| As we can see, the output is as expected.
 
| As we can see, the output is as expected.
 
  
 
|-
 
|-
 
|  02:46
 
|  02:46
 
| But this method only prints the word but does not create one.
 
| But this method only prints the word but does not create one.
 
  
 
|-
 
|-
 
|  02:50
 
|  02:50
 
| To create a word, we use the '''String''' data type.  
 
| To create a word, we use the '''String''' data type.  
 
  
 
|-
 
|-
Line 145: Line 131:
 
|-
 
|-
 
|  02:57
 
|  02:57
|   remove everything inside the main method and type
+
| Remove everything inside the '''main method''' and type:
 
+
  
 
|-
 
|-
 
|  03:03
 
|  03:03
| ''' String greet '''''equal to '''''Hello Learner ''''':
+
| '''String greet''' equal to "Hello Learner";
 
+
  
 
|-
 
|-
 
|  03:16
 
|  03:16
| Note that   '''S '''in the word  '''String''' is in uppercase.
+
| Note that 'S' in the word  '''String''' is in uppercase.
 
+
  
 
|-
 
|-
 
|  03:19
 
|  03:19
| And we are using double quotes instead of  single quotes as delimiters   
+
| And we are using double quotes instead of  single quotes as delimiters.    
  
 
|-
 
|-
 
|  03:25
 
|  03:25
| This statement creates a variable '''greet''' that is of the type '''String'''
+
| This statement creates a variable '''greet''' that is of the type '''String'''.
 
+
  
 
|-
 
|-
Line 177: Line 159:
 
|-
 
|-
 
|  03:44
 
|  03:44
| Save  the file and run it
+
| Save  the file and run it.
 
|-
 
|-
 
|  03:51
 
|  03:51
 
| As we can see, the message has been stored in the variable and it has been printed.
 
| As we can see, the message has been stored in the variable and it has been printed.
 
  
 
|-
 
|-
 
|  03:57
 
|  03:57
 
| Strings can also be added in Java.
 
| Strings can also be added in Java.
 
  
 
|-
 
|-
Line 202: Line 182:
 
|-
 
|-
 
|  04:14
 
|  04:14
|  '''String name '''''equal to '''''“Java”;'''
+
|  '''String name '''equal to “Java”;
 
+
  
 
|-
 
|-
 
|  04:22
 
|  04:22
| Now we’ll add the strings to make a message
+
| Now we’ll add the strings to make a message.
 
+
  
 
|-
 
|-
 
|  04:28
 
|  04:28
| '''String msg '''''equal to '''''greet '''''plus '''''name ; '''
+
| '''String msg''' equal to '''greet''' plus '''name;'''
 
+
  
 
|-
 
|-
 
|  04:42
 
|  04:42
| change  the greet  '''println(greet)''' in the print statement  to message  '''println(msg)''' save the file  and run it.
+
| change  the greet  '''println(greet)''' in the print statement  to message  '''println(msg)''' save the file  and '''run''' it.
 
+
  
 
|-
 
|-
Line 226: Line 202:
 
|-
 
|-
 
|  05:00
 
|  05:00
| But there is no space separating them.
+
| But there is no 'space' separating them.
  
 
|-
 
|-
 
|  05:02
 
|  05:02
| So Let us create a space character  
+
| So, let us create a space character.
 
+
  
 
|-
 
|-
 
|  05:08
 
|  05:08
| '''char SPACE '''''equal to '''''' in single quotes ''' space'''  
+
| '''char SPACE''' equal to in single quotes '''space'''  
 
+
  
 
|-
 
|-
 
|  05:17
 
|  05:17
 
| Note that I have used all uppercase letters in the variable name so that it is clear.
 
| Note that I have used all uppercase letters in the variable name so that it is clear.
 
  
 
|-
 
|-
 
|  05:23
 
|  05:23
 
| You can change it as you want.
 
| You can change it as you want.
 
  
 
|-
 
|-
 
|  05:26
 
|  05:26
| Now let us add the space to the message.
+
| Now, let us add the '''space''' to the message.
 
+
  
 
|-
 
|-
 
|  05:29
 
|  05:29
| '''greet '''''plus '''''SPACE '''''plus '''''name'''
+
| '''greet''' plus SPACE plus '''name'''
 
+
  
 
|-
 
|-
 
|  05:36
 
|  05:36
| save the file and run it
+
| '''save''' the file and '''run''' it.
  
 
|-
 
|-
 
|  05:40
 
|  05:40
 
| Now  we can see  the output is clear and as expected.
 
| Now  we can see  the output is clear and as expected.
 
  
 
|-
 
|-
 
|  05:45
 
|  05:45
| Let us look at a few   string operations.
+
| Let us look at a few '''string operations'''.
  
 
|-
 
|-
 
|  05:50
 
|  05:50
 
|  I’m changing a few characters of the word “Hello” to upper case  and of the word “java” to uppercase.  
 
|  I’m changing a few characters of the word “Hello” to upper case  and of the word “java” to uppercase.  
 
  
 
|-
 
|-
 
|  06:05
 
|  06:05
 
| Often, when users give input, we have values like this, in mixed case.
 
| Often, when users give input, we have values like this, in mixed case.
 
  
 
|-
 
|-
 
|  06:11
 
|  06:11
| So Let us run the file to see the output.
+
| So, Let us '''run''' the file to see the output.
 
+
  
 
|-
 
|-
 
|  06:18
 
|  06:18
| As we can see t he output is not clean.
+
| As we can see, the output is not clean.
 
+
  
 
|-
 
|-
Line 297: Line 262:
 
|-
 
|-
 
|  06:27
 
|  06:27
|   type, '''greet '''''equal to '''''greet.toLowerCase();'''
+
| Type: '''greet''' equal to '''greet.toLowerCase();'''
 
+
  
 
|-
 
|-
 
|  06:41
 
|  06:41
| This statement converts each character of the string '''greet''' to lowercase
+
| This statement converts each character of the string '''greet''' to lowercase.
 
+
  
 
|-
 
|-
 
|  06:47
 
|  06:47
|  '''name '''''equal to '''''name.toUpperCase();'''
+
|  '''name''' equal to '''name.toUpperCase();'''
 
+
  
 
|-
 
|-
 
|  06:58
 
|  06:58
 
| This statement converts each character of the string '''name '''to uppercase.
 
| This statement converts each character of the string '''name '''to uppercase.
 
  
 
|-
 
|-
 
|  07:03
 
|  07:03
| Save the file and Run it.
+
| '''Save''' the file and '''Run''' it.
 
+
  
 
|-
 
|-
Line 326: Line 286:
 
|-
 
|-
 
| 07:13
 
| 07:13
|This is how we create strings and perform string operations.
+
|This is how we create '''strings''' and perform string operations.
 
+
  
 
|-
 
|-
 
|  07:18
 
|  07:18
| There are  more String methods and
+
| There are  more '''String methods''' and
  
 
|-
 
|-
Line 343: Line 302:
 
|-
 
|-
 
|  07:29
 
|  07:29
| In this tutorial we have learnt  
+
| In this tutorial, we have learnt:
  
 
|-
 
|-
 
|  07:31
 
|  07:31
| '''how to create strings ,addstrings '''
+
| how to create '''strings''', add '''strings '''
  
 
|-
 
|-
 
|  07:33
 
|  07:33
|and perform  ''' string operations like converting to lower case and upper case'''
+
|and perform  '''string operations''' like converting to lower case and upper case.
  
 
|-
 
|-
 
|  07:39
 
|  07:39
 
   
 
   
|  | As a assignment for this tutorial.
+
|  | As an assignment for this tutorial:
  
 
|-
 
|-
 
|  07:41
 
|  07:41
| Read about the '''concat''' method of Strings in Java. - Find out how is it different from adding strings.
+
| Read about the '''concat method''' of '''Strings''' in Java. Find out how is it different from adding '''strings'''.
  
 
|-
 
|-
 
|  07:50
 
|  07:50
| To know more about the '''Spoken Tutorial''' project, watch the video available at the following link.
+
| To know more about the 'Spoken Tutorial' project, watch the video available at the following link.
  
 
|-
 
|-
 
|  07:55
 
|  07:55
| * It summarises the Spoken Tutorial project
+
| It summarizes the Spoken Tutorial project.
  
 
|-
 
|-
 
|  07:58
 
|  07:58
| If you do not have good bandwidth, you can download and watch it
+
| If you do not have good bandwidth, you can download and watch it.
 
+
 
+
 
+
 
   
 
   
 
|-
 
|-
 
|  08:03
 
|  08:03
|  The Spoken Tutorial Project Team.
+
|  The Spoken Tutorial Project Team:
 
+
  
 
|-
 
|-
 
|  08:05
 
|  08:05
 
| Conducts workshops using '''spoken tutorials'''.
 
| Conducts workshops using '''spoken tutorials'''.
 
  
 
|-
 
|-
Line 393: Line 347:
 
|-
 
|-
 
|  08:17
 
|  08:17
| '''Spoken Tutorial '''Project is a part of the '''Talk to a Teacher''' project  
+
| 'Spoken Tutorial' Project is a part of the 'Talk to a Teacher' project.
  
 
|-
 
|-
 
|  08:21
 
|  08:21
| It supported by the '''National Mission on Education through ICT, MHRD, Government of India.  
+
| It supported by the National Mission on Education through ICT, MHRD, Government of India.  
 
|-
 
|-
 
|  08:28
 
|  08:28
| '''More information on this Mission is available at  the  following links'''spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro'''
+
| More information on this mission is available at  the  following link: '''spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro'''.
  
 
|-
 
|-
 
|  08:33  
 
|  08:33  
|   This tutorial has been contributed by '''TalentSprint'''. Thanks for joining.
+
|This tutorial has been contributed by '''TalentSprint'''. Thanks for joining.
 
+
 
+
 
+
  
 
|}
 
|}

Revision as of 20:19, 20 March 2015

Time Narration
00:01 Welcome to the spoken tutorial on Strings in Java.
00:05 In this tutorial, you will learn how to:
00:08 create strings, add strings and perform basic string operations like converting to lower case and upper case.
00:18 For this tutorial, we are using

Ubuntu 11.10, JDK 1.6 and

Eclipse 3.7'

00:26 To follow this tutorial, you must have the knowledge of data types in Java.
00:32 If not, for relevant tutorials, please visit our website as shown.
00:40 String in Java, is a sequence of characters.
00:44 Before starting with Strings, we will first see the character data type.
00:50 Let us now switch to eclipse.
00:55 we have the 'Eclipse IDE' and the skeleton required for the rest of the code.
01:00 We have created a class StringDemo and added the main method.
01:07 Inside the main method, type: char star equal to in single quotes asterisks.
01:19 This statement creates a variable with name star and of the type char.
01:25 It can store exactly one character.
01:28 Let us print a word using a few characters.
01:33 Remove the char line and type:
01:36 char c1 equal to in single quotes 'c'
01:43 char c2 equal to in single quotes 'a'
01:49 char c3 equal to in single quotes 'r'
01:55 We have created three characters to make the word car.
01:59 Now let us use them to print the word.
02:02 Type:
02:04 System.out.print(c1);
02:12 System.out.print(c2);
02:22 System.out.print(c3);
02:31 Please note that I’m using print instead of println so that all the characters are printed on the same line.
02:39 save the file and run it.
02:43 As we can see, the output is as expected.
02:46 But this method only prints the word but does not create one.
02:50 To create a word, we use the String data type.
02:54 Let us try it out.
02:57 Remove everything inside the main method and type:
03:03 String greet equal to "Hello Learner";
03:16 Note that 'S' in the word String is in uppercase.
03:19 And we are using double quotes instead of single quotes as delimiters.
03:25 This statement creates a variable greet that is of the type String.
03:31 Now Let us print the message.
03:33 System.out.println(greet);
03:44 Save the file and run it.
03:51 As we can see, the message has been stored in the variable and it has been printed.
03:57 Strings can also be added in Java.
04:00 let us see how to do so.
04:04 I'm removing the Learner from the message.
04:08 We'll store the name in a different variable.
04:14 String name equal to “Java”;
04:22 Now we’ll add the strings to make a message.
04:28 String msg equal to greet plus name;
04:42 change the greet println(greet) in the print statement to message println(msg) save the file and run it.
04:56 We can see that the output shows the greeting and the name.
05:00 But there is no 'space' separating them.
05:02 So, let us create a space character.
05:08 char SPACE equal to in single quotes space
05:17 Note that I have used all uppercase letters in the variable name so that it is clear.
05:23 You can change it as you want.
05:26 Now, let us add the space to the message.
05:29 greet plus SPACE plus name
05:36 save the file and run it.
05:40 Now we can see the output is clear and as expected.
05:45 Let us look at a few string operations.
05:50 I’m changing a few characters of the word “Hello” to upper case and of the word “java” to uppercase.
06:05 Often, when users give input, we have values like this, in mixed case.
06:11 So, Let us run the file to see the output.
06:18 As we can see, the output is not clean.
06:22 So let us use the String methods to clean the input.
06:27 Type: greet equal to greet.toLowerCase();
06:41 This statement converts each character of the string greet to lowercase.
06:47 name equal to name.toUpperCase();
06:58 This statement converts each character of the string name to uppercase.
07:03 Save the file and Run it.
07:08 As we can see, the output is now clean after we have used the String methods.
07:13 This is how we create strings and perform string operations.
07:18 There are more String methods and
07:19 We'll discuss them as we move on to complex topics.
07:26 This brings us to the end of this tutorial.
07:29 In this tutorial, we have learnt:
07:31 how to create strings, add strings
07:33 and perform string operations like converting to lower case and upper case.
07:39 As an assignment for this tutorial:
07:41 Read about the concat method of Strings in Java. Find out how is it different from adding strings.
07:50 To know more about the 'Spoken Tutorial' project, watch the video available at the following link.
07:55 It summarizes the Spoken Tutorial project.
07:58 If you do not have good bandwidth, you can download and watch it.
08:03 The Spoken Tutorial Project Team:
08:05 Conducts workshops using spoken tutorials.
08:07 Gives certificates to those who pass an online test. For more details, please write to contact AT spoken HYPHEN tutorial DOT org.
08:17 'Spoken Tutorial' Project is a part of the 'Talk to a Teacher' project.
08:21 It supported by the National Mission on Education through ICT, MHRD, Government of India.
08:28 More information on this mission is available at the following link: spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro.
08:33 This tutorial has been contributed by TalentSprint. Thanks for joining.

Contributors and Content Editors

Gaurav, PoojaMoolya, Sandhya.np14, Sneha