Difference between revisions of "Java/C2/Creating-class/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 2: Line 2:
 
|| '''Time'''
 
|| '''Time'''
 
|| '''Narration'''
 
|| '''Narration'''
 +
 
|-
 
|-
| 00:02
+
|00:02
| Welcome to the spoken tutorial on '''Creating classes'''.
+
|Welcome to the spoken tutorial on '''Creating classes'''.
  
 
|-
 
|-
| 00:05
+
|00:05
|   In this tutorial, we will learn about:
+
| In this tutorial, we will learn about:
  
 
|-
 
|-
| 00:08
+
|00:08
 
| A '''class''' in real world
 
| A '''class''' in real world
 +
 
|-
 
|-
| 00:10
+
|00:10
 
| A '''class''' in Java
 
| A '''class''' in Java
 +
 
|-
 
|-
| 00:12
+
|00:12
| Structure of a '''Java class'''  
+
|Structure of a '''Java class'''  
 +
 
 
|-
 
|-
| 00:14
+
|00:14
 
|Syntax for a''' Java class'''
 
|Syntax for a''' Java class'''
 +
 
|-
 
|-
| 00:16
+
|00:16
| And a simple example of '''Java class'''.
+
|And a simple example of '''Java class'''.
 +
 
 
|-
 
|-
| 00:19
+
| 00:19
 
| Here we are using:
 
| Here we are using:
 
'''Ubuntu version 11.10'''  
 
'''Ubuntu version 11.10'''  
Line 33: Line 39:
  
 
|-
 
|-
| 00:30
+
| 00:30
 
| To follow this tutorial, you must know how to write, compile and '''run''' a simple Java program in '''Eclipse'''.
 
| To follow this tutorial, you must know how to write, compile and '''run''' a simple Java program in '''Eclipse'''.
  
 
|-
 
|-
| 00:37
+
|00:37
 
|If not, please see the spoken-tutorial on these topics, available at '''spoken-tutorial.org'''.
 
|If not, please see the spoken-tutorial on these topics, available at '''spoken-tutorial.org'''.
  
Line 45: Line 51:
  
 
|-
 
|-
| 00:50
+
|00:50
 
|Whatever we can see in this world are all objects.
 
|Whatever we can see in this world are all objects.
  
 
|-
 
|-
| 00:54
+
|00:54
 
|And all the objects can be categorized into special groups.
 
|And all the objects can be categorized into special groups.
  
 
|-
 
|-
| 00:59
+
|00:59
 
|Each group is termed as a '''class'''.
 
|Each group is termed as a '''class'''.
  
 
|-
 
|-
| 01:02
+
|01:02
 
|For example, human being is a '''class'''.
 
|For example, human being is a '''class'''.
  
 
|-
 
|-
| 01:05
+
|01:05
 
|We are all different objects of this '''class'''.
 
|We are all different objects of this '''class'''.
  
 
|-
 
|-
| 01:08
+
|01:08
 
|We all have different properties like eyes, legs, hands etc.
 
|We all have different properties like eyes, legs, hands etc.
  
 
|-
 
|-
| 01:13
+
|01:13
| which are common to the 'human being' class.
+
|which are common to the 'human being' class.
  
 
|-
 
|-
| 01:15
+
|01:15
 
|Seeing, eating, walking etc are behaviors that are common to the human being class.
 
|Seeing, eating, walking etc are behaviors that are common to the human being class.
  
 
|-
 
|-
| 01:22   
+
|01:22   
 
|Now let us see what is the '''class''' in '''Java'''?
 
|Now let us see what is the '''class''' in '''Java'''?
  
 
|-
 
|-
|   01:26
+
| 01:26
 
| A''' class '''is the blueprint from which individual objects are created.
 
| A''' class '''is the blueprint from which individual objects are created.
  
 
|-
 
|-
| 01:31
+
| 01:31
 
| Structure of a '''Java Class'''; A '''class''' defines:
 
| Structure of a '''Java Class'''; A '''class''' defines:
  
 
|-
 
|-
| 01:35
+
|01:35
|* A set of properties called '''variables '''.
+
|A set of properties called '''variables '''.
  
 
|-
 
|-
| 01:37
+
|01:37
|* And a set of behaviors called '''methods.'''
+
|And a set of behaviors called '''methods.'''
  
 
|-
 
|-
| 01:40
+
|01:40
| Now, let us see the syntax for declaring '''classes'''.
+
|Now, let us see the syntax for declaring '''classes'''.
  
 
|-
 
|-
| 01:44
+
|01:44
 
|'''modifier – class -classname''' within  curly brackets '''variable, constructor''' and '''method''' declarations.
 
|'''modifier – class -classname''' within  curly brackets '''variable, constructor''' and '''method''' declarations.
  
 
|-
 
|-
| 01:52
+
|01:52
 
|We will learn about these in detail, in the coming tutorials.
 
|We will learn about these in detail, in the coming tutorials.
  
 
|-
 
|-
| 01:58
+
|01:58
 
|Now, let us create a simple '''class ''' using '''Eclipse'''.
 
|Now, let us create a simple '''class ''' using '''Eclipse'''.
  
 
|-
 
|-
| 02:03
+
|02:03
 
|I have already opened '''Eclipse'''.
 
|I have already opened '''Eclipse'''.
  
 
|-
 
|-
| 02:09
+
|02:09
 
|Now let us create a '''Project.'''
 
|Now let us create a '''Project.'''
  
 
|-
 
|-
| 02:11
+
|02:11
 
|So click on '''File,''' go to '''New ''' and click on '''Java Project.'''
 
|So click on '''File,''' go to '''New ''' and click on '''Java Project.'''
  
 
|-
 
|-
| 02:20
+
|02:20
 
| In the '''New Project''' Wizard, enter the '''Project name ''' as '''ClassDemo''' with C and D in capital.
 
| In the '''New Project''' Wizard, enter the '''Project name ''' as '''ClassDemo''' with C and D in capital.
  
 
|-
 
|-
| 02:34
+
|02:34
 
|Then click on '''Finish'''.
 
|Then click on '''Finish'''.
  
 
|-
 
|-
| 02:38
+
|02:38
| We see that the '''Project ClassDemo''' is created.
+
|We see that the '''Project ClassDemo''' is created.
  
 
|-
 
|-
 
|02:43
 
|02:43
| We will now create a Java '''class''' named '''Student'''.
+
|We will now create a Java '''class''' named '''Student'''.
  
 
|-
 
|-
| 02:47
+
|02:47
 
|So, right click on''' ClassDemo''', go to''' New''' and click on '''Class'''.
 
|So, right click on''' ClassDemo''', go to''' New''' and click on '''Class'''.
  
 
|-
 
|-
| 02:56
+
|02:56
 
|In the '''New Java Class''' wizard, type the '''Name''' as '''Student.'''
 
|In the '''New Java Class''' wizard, type the '''Name''' as '''Student.'''
  
 
|-
 
|-
| 03:03
+
|03:03
 
|We can see that the '''modifier''' here is''' public'''.
 
|We can see that the '''modifier''' here is''' public'''.
  
 
|-
 
|-
| 03:07
+
|03:07
 
|This shows that the '''class''' is visible to all the classes everywhere.
 
|This shows that the '''class''' is visible to all the classes everywhere.
  
 
|-
 
|-
| 03:11
+
|03:11
 
|If a '''class''' has no '''modifier''' which is the '''default''', it is visible only within its own '''package.'''
 
|If a '''class''' has no '''modifier''' which is the '''default''', it is visible only within its own '''package.'''
  
 
|-
 
|-
| 03:18
+
|03:18
 
|We will learn about '''packages''' in the later tutorials.
 
|We will learn about '''packages''' in the later tutorials.
  
Line 250: Line 256:
 
|-
 
|-
 
| 06:33  
 
| 06:33  
|  We get the output as :
+
|  We get the output as :'''We have created a class with 2 variables and 1 method''',  
 
+
|-
+
|  06:34
+
|'''We have created a class with 2 variables and 1 method''',  
+
  
 
|-
 
|-
Line 269: Line 271:
  
 
|-
 
|-
| 06:59
+
| 06:59
 
| For self assessment, create a '''class''' named '''Employee''' with variables '''emp''' underscore '''number''' and '''emp''' underscore '''name''' .
 
| For self assessment, create a '''class''' named '''Employee''' with variables '''emp''' underscore '''number''' and '''emp''' underscore '''name''' .
  
 
|-
 
|-
| 07:10
+
| 07:10
 
|And '''method''' '''printEmployee''' which displays the '''employee''' information.
 
|And '''method''' '''printEmployee''' which displays the '''employee''' information.
  
Line 285: Line 287:
  
 
|-
 
|-
| 07:22
+
| 07:22
 
| It summarizes the Spoken Tutorial project.  
 
| It summarizes the Spoken Tutorial project.  
  
 
|-
 
|-
| 07:25
+
| 07:25
 
| 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.  
  
 
|-
 
|-
| 07:30   
+
| 07:30   
 
| The Spoken Tutorial project team:  
 
| The Spoken Tutorial project team:  
  
 
|-
 
|-
| 07:32
+
| 07:32
 
| Conducts workshops using spoken tutorials.  
 
| Conducts workshops using spoken tutorials.  
  
 
|-
 
|-
| 07:35
+
| 07:35
 
|Gives certificates to those who pass an online test.
 
|Gives certificates to those who pass an online test.
  

Revision as of 15:31, 9 March 2017

Time Narration
00:02 Welcome to the spoken tutorial on Creating classes.
00:05 In this tutorial, we will learn about:
00:08 A class in real world
00:10 A class in Java
00:12 Structure of a Java class
00:14 Syntax for a Java class
00:16 And a simple example of Java class.
00:19 Here we are using:

Ubuntu version 11.10 JDK 1.6 and Eclipse 3.7.0

00:30 To follow this tutorial, you must know how to write, compile and run a simple Java program in Eclipse.
00:37 If not, please see the spoken-tutorial on these topics, available at spoken-tutorial.org.
00:46 Now let us see what is a class in real world.
00:50 Whatever we can see in this world are all objects.
00:54 And all the objects can be categorized into special groups.
00:59 Each group is termed as a class.
01:02 For example, human being is a class.
01:05 We are all different objects of this class.
01:08 We all have different properties like eyes, legs, hands etc.
01:13 which are common to the 'human being' class.
01:15 Seeing, eating, walking etc are behaviors that are common to the human being class.
01:22 Now let us see what is the class in Java?
01:26 A class is the blueprint from which individual objects are created.
01:31 Structure of a Java Class; A class defines:
01:35 A set of properties called variables .
01:37 And a set of behaviors called methods.
01:40 Now, let us see the syntax for declaring classes.
01:44 modifier – class -classname within curly brackets variable, constructor and method declarations.
01:52 We will learn about these in detail, in the coming tutorials.
01:58 Now, let us create a simple class using Eclipse.
02:03 I have already opened Eclipse.
02:09 Now let us create a Project.
02:11 So click on File, go to New and click on Java Project.
02:20 In the New Project Wizard, enter the Project name as ClassDemo with C and D in capital.
02:34 Then click on Finish.
02:38 We see that the Project ClassDemo is created.
02:43 We will now create a Java class named Student.
02:47 So, right click on ClassDemo, go to New and click on Class.
02:56 In the New Java Class wizard, type the Name as Student.
03:03 We can see that the modifier here is public.
03:07 This shows that the class is visible to all the classes everywhere.
03:11 If a class has no modifier which is the default, it is visible only within its own package.
03:18 We will learn about packages in the later tutorials.
03:23 Here I have selected public.
03:26 In the 'method stubs', select public static void main.
03:31 Then click on Finish.
03:36 We can see that the class named Student is created.
03:40 Now, let me remove the comments.
03:51 A Student class can contain properties like Name, Roll Number, Marks etc.
03:57 So, inside this class Student, let me declare two variables roll_Number and name.
04:04 So, I will type int roll underscore number semicolon.
04:14 String name semicolon.
04:19 So, I have declared two variables.
04:22 Now, a class also contains methods.
04:25 So, let me create a method named StudentDetail.
04:30 This method will give the details of each student.
04:34 So let me type, void studentDetail then opening and closing brackets, curly brackets open.
04:49 Now, this method will give the roll_number and name of the Student.
04:53 So, type System dot out dot println within brackets and double quotes The roll number is we can type it as number is, close the double quotes plus roll_number semicolon.
05:23 Next line, type: System dot out dot println within brackets and double quotes The name is plus name and semicolon.
05:40 Now, inside the main method, we will type: System dot out dot println within brackets and double quotes We have created a class with 2 variables and 1 method.
06:10 Thus, We have created the class student.
06:20 Now, let me save the file by pressing Control and S keys simultaneously.
06:26 Let me Run the program by pressing Control and F11 keys simultaneously.
06:33 We get the output as :We have created a class with 2 variables and 1 method,
06:38 just as we had typed in the main method.
06:46 Thus we have successfully created a class.
06:50 So, in this tutorial, we learnt about the class in java and how to create a class in java.
06:59 For self assessment, create a class named Employee with variables emp underscore number and emp underscore name .
07:10 And method printEmployee which displays the employee information.
07:16 To know more about the spoken-tutorial project,
07:19 watch the video available at [1].
07:22 It summarizes the Spoken Tutorial project.
07:25 If you do not have good bandwidth, you can download and watch it.
07:30 The Spoken Tutorial project team:
07:32 Conducts workshops using spoken tutorials.
07:35 Gives certificates to those who pass an online test.
07:38 For more details, please write to contact@spoken-tutorial.org
07:44 Spoken Tutorial project is a part of the Talk to a Teacher project.
07:48 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
07:55 More information on this mission is available at [2].
08:04 Thus, we come to the end of this tutorial.
08:07 This is Arya Ratish from IIT Bomaby, signing off. Thanks for joining us.

Contributors and Content Editors

Gaurav, PoojaMoolya, Sandhya.np14, Sneha