Java/C2/Creating-class/Gujarati

From Script | Spoken-Tutorial
Revision as of 10:37, 13 August 2013 by Jyotisolanki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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 name 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 detail 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 two 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 meRun the program by pressing Control and F11 keys simultaneously.



06:33 We get the output as :


06:34 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 a 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 http://spoken-tutorial.org/What_is_a_Spoken_Tutorial
07:22 It summarises 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


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

Jyotisolanki, Krupali, PoojaMoolya, Pratik kamble