Creating your own class

Published on Slideshow
Static slideshow
Download PDF version
Download PDF version
Embed video
Share video
Ask about this video

Scene 1 (0s)

[Audio] Good afternoon everyone, I am your facilitator today Dr. Myra G. Flores for our topic creating your own class..

Scene 2 (10s)

[Audio] Later you will have the example in creating your own class. Before writing your class, you have to think first on where you will be using you class and how it will be used. Do not forget that you need to think of an appropriate name for the class, it must be unique and not a reserve word and list all the information you need. In addition you have to list down all the method you will be using for your class..

Scene 3 (37s)

[Audio] To define a class, we have to write the following as your syntax. Always remember that the modifier here is an access modifier, which may be combined with other types of modifier..

Scene 4 (51s)

[Audio] Always remember that every object that we will be creating has its own member of a class which is a concrete example of the class. This is the is-a relationship. We can also define the instantiation which is the creation of the class and the reusability. Which in return we can reuse our own created classes..

Scene 5 (1m 13s)

[Audio] How do we define instantiation? From what is .com instantiation is the creation of a real instance or particular realization of an ion or template such as a class of objects or a computer process. To instantiate is to create such an instance by, for example, defining one particular variation of object within a class, giving it a name, and locating it in some physical place.

Scene 6 (1m 40s)

[Audio] Always remember: That when you are going to create a class, there is always a top-level we have to consider. Remember, the only valid access modifiers are the public and package. The default class modifier is always public..

Scene 7 (1m 59s)

[Audio] When creating a class, there will be a method that can be used to create as well. It will be called upon to return a piece of information to source the request. Remember as well that when you create a class you are also creating a class client or class user. In this case, an application or class instantiates or being created to an objects of another pre-written classes. This is applicable in the classes you are creating. Because you are creating the source of information..

Scene 8 (2m 33s)

[Audio] In creating your class remember the following Assign name to class Determine what data and methods will be part of class Use class Class header access modifier is always Optional here Keyword class is mandatory And use any legal identifier for the name of class 4. public class When we say public class it is accessible by all objects..

Scene 9 (3m 7s)

[Audio] This is an example of defining your own class. In this example public means that our class is accessible to other classes outside the package. Class in this example is the keyword used to create a class in Java And the StudentRecord is a unique identifier that describes our class..

Scene 10 (3m 29s)

[Audio] This is again another example of our class..

Scene 11 (3m 37s)

[Audio] Remember: Think of an appropriate name for your class. Don't just call your class XYZ or any random names you can think of. Class names should start with a CAPITAL letter. The filename of your class should have the SAME NAME as your public class name.