1
00:00:00,710 --> 00:00:04,390
Industry or Tauriel I want to talk a little bit about classes.

2
00:00:04,590 --> 00:00:09,420
So first let me show you how you can open and close a project.

3
00:00:09,450 --> 00:00:15,840
So in order to open a closed project you just need to double click on it and if you want to actually

4
00:00:16,380 --> 00:00:22,720
close the project just to right click on your project and click on our close project OK.

5
00:00:22,740 --> 00:00:25,310
As you can see this is the close project here.

6
00:00:25,550 --> 00:00:26,140
OK.

7
00:00:26,460 --> 00:00:29,020
So if you want to delete it you can delete.

8
00:00:29,190 --> 00:00:34,260
Right click on your project and then click on it and be sure to check this option here it is.

9
00:00:34,260 --> 00:00:40,470
Project contents on this if you want to completely remove your project from your system.

10
00:00:40,470 --> 00:00:47,670
So first we need actually we need a job a project or the name of what project should be our classes

11
00:00:48,510 --> 00:00:53,390
pre-K the project name should start with a capital letter.

12
00:00:53,450 --> 00:00:54,300
OK.

13
00:00:54,450 --> 00:00:57,440
I use different location and play can finish.

14
00:00:57,800 --> 00:00:58,300
OK.

15
00:00:58,500 --> 00:01:00,730
Now we need to create a Java class.

16
00:01:00,900 --> 00:01:06,870
So in order to create a Java class when it arrives like this as our C for that or this class project

17
00:01:07,610 --> 00:01:12,860
right click on it and actually knew and click on class.

18
00:01:12,870 --> 00:01:13,530
OK.

19
00:01:13,800 --> 00:01:18,230
So for the name of the class I prefer to type in my class.

20
00:01:18,300 --> 00:01:18,980
OK.

21
00:01:19,200 --> 00:01:23,410
We can use any name that you want for the modifiers to public.

22
00:01:23,640 --> 00:01:28,000
And this time check this check box here that says public static void main.

23
00:01:28,140 --> 00:01:31,280
This is actually going to create the main method for us.

24
00:01:31,340 --> 00:01:31,630
OK.

25
00:01:31,630 --> 00:01:33,290
And click can finish.

26
00:01:33,390 --> 00:01:38,180
And as you can see here the main Mfat has been created automatically for us by eclipse.

27
00:01:38,190 --> 00:01:40,580
So this slide here as you can see here this is a comment.

28
00:01:40,590 --> 00:01:41,160
OK.

29
00:01:41,370 --> 00:01:44,360
I teach you about comments later in the section.

30
00:01:44,400 --> 00:01:51,510
So just delete this slide and the first thing that I want to teach you about classes is that classes

31
00:01:51,600 --> 00:01:52,780
are like blueprints.

32
00:01:52,830 --> 00:02:00,810
For example if I want to create a Mercedes-Benz OK I need a blueprint I need a blueprint that actually

33
00:02:00,810 --> 00:02:09,120
can teach me can actually instruct me that include instructions how to create our Mercedes-Benz.

34
00:02:09,180 --> 00:02:09,690
OK.

35
00:02:09,790 --> 00:02:11,510
And classes are the same.

36
00:02:11,520 --> 00:02:18,570
For example if I want to create a Mercedes-Benz I need a blueprint that its name is a Mercedes-Benz

37
00:02:18,690 --> 00:02:22,320
as you can see I can create another class for example.

38
00:02:22,350 --> 00:02:27,110
I can create files and click on File new and class.

39
00:02:27,330 --> 00:02:30,700
Ok for example I want to create a car.

40
00:02:30,740 --> 00:02:32,250
Ok car.

41
00:02:32,660 --> 00:02:33,320
OK.

42
00:02:33,660 --> 00:02:39,020
I click on this checkbox here topics that what man made I click on finish.

43
00:02:39,090 --> 00:02:42,620
OK this is the blueprint for creating a car.

44
00:02:42,840 --> 00:02:45,180
OK this is just a blueprint.

45
00:02:45,180 --> 00:02:47,550
All classes are blueprints.

46
00:02:47,580 --> 00:02:48,290
OK.

47
00:02:48,660 --> 00:02:54,990
So I teach you more about classes later in this course and this is just an introduction to give you

48
00:02:54,990 --> 00:02:57,150
some knowledge about these classes.

49
00:02:57,150 --> 00:02:57,760
OK.

50
00:02:58,060 --> 00:03:07,290
So the next thing that I want to teach you about is that the name of all classes that we create must

51
00:03:07,290 --> 00:03:10,380
be the same as the name of the job or Foyle's.

52
00:03:10,390 --> 00:03:16,110
Here for example as you can see this is the class that we have created.

53
00:03:16,180 --> 00:03:16,860
OK.

54
00:03:17,040 --> 00:03:19,240
In my class that job are fine.

55
00:03:19,320 --> 00:03:20,020
OK.

56
00:03:20,280 --> 00:03:23,370
And does the name of this class is my class.

57
00:03:23,410 --> 00:03:30,930
So as you can see here this is that my class that job or the name of this job is my class too.

58
00:03:30,930 --> 00:03:40,110
So first let me point out that if I for example change the name of this class to my classes as you can

59
00:03:40,110 --> 00:03:42,800
see Eclipse is going to complain.

60
00:03:43,350 --> 00:03:44,700
It's going to show me an error.

61
00:03:44,730 --> 00:03:46,450
So let's see what's this error.

62
00:03:46,560 --> 00:03:48,360
The public type.

63
00:03:48,510 --> 00:03:53,430
My classes must be defined in its own right.

64
00:03:53,430 --> 00:04:01,060
So as you can see here this class my classes is not owned by either my class that Java.

65
00:04:01,440 --> 00:04:05,070
So we need to actually change it back to my class.

66
00:04:05,100 --> 00:04:06,270
OK.

67
00:04:06,630 --> 00:04:08,290
And let's see another example.

68
00:04:08,430 --> 00:04:13,450
As you can see here I'll change the name of this class car to cars.

69
00:04:13,470 --> 00:04:14,120
OK.

70
00:04:14,370 --> 00:04:16,360
As you can see the name of this class is car.

71
00:04:16,380 --> 00:04:16,890
OK.

72
00:04:17,010 --> 00:04:20,080
And the name of the java file here is card too.

73
00:04:20,100 --> 00:04:27,630
So if I change it two cars as you can see it's going to show me an error and it says the public type

74
00:04:27,860 --> 00:04:31,360
cars must be defined in it's all fine.

75
00:04:31,590 --> 00:04:37,250
So as you can see these cars class is not owned by this car that job is fine.

76
00:04:37,560 --> 00:04:48,930
So there are some exceptions to for example Actually if I actually change this class class name here

77
00:04:48,930 --> 00:04:51,500
are two cars and it's gonna show me an error.

78
00:04:51,510 --> 00:04:52,140
OK.

79
00:04:52,260 --> 00:04:54,180
So let's see what the error is.

80
00:04:54,300 --> 00:05:01,590
Again the public high cars must be defined in its own fight as you can see it is the public type.

81
00:05:01,590 --> 00:05:04,500
So let's actually delete this public here.

82
00:05:04,650 --> 00:05:09,760
And as you can see the air is God and it's tested again in my classes.

83
00:05:10,020 --> 00:05:15,760
So if I change into my classes the name of the class to my classes let's delete this public.

84
00:05:16,200 --> 00:05:20,170
And it's going to actually delete the error for me again.

85
00:05:20,460 --> 00:05:23,470
OK so what's going on.

86
00:05:23,470 --> 00:05:28,560
Are all public classes as you can see in every fight in every job.

87
00:05:28,650 --> 00:05:31,660
You can actually create only one public class.

88
00:05:31,830 --> 00:05:32,530
OK.

89
00:05:32,640 --> 00:05:37,670
You can actually create you just one fine one public fight.

90
00:05:37,950 --> 00:05:38,700
OK.

91
00:05:38,970 --> 00:05:46,740
But you can create unlimited classes in your files for example if I change this class to for example

92
00:05:46,740 --> 00:05:56,070
if I put the public back into this class ok and change this card is class 2 car OK and it's going to

93
00:05:56,070 --> 00:05:58,950
actually erase the error for me.

94
00:05:58,950 --> 00:06:03,560
For example if I actually want to put another party class in this fight.

95
00:06:03,750 --> 00:06:05,410
As you can see this is the end of my class.

96
00:06:05,430 --> 00:06:09,760
Ok so I can add another class here public.

97
00:06:10,450 --> 00:06:12,390
OK class.

98
00:06:12,920 --> 00:06:13,690
OK.

99
00:06:13,920 --> 00:06:16,680
So let's this time typing anymore.

100
00:06:16,730 --> 00:06:17,150
OK.

101
00:06:17,160 --> 00:06:18,600
The class of Haleema.

102
00:06:19,530 --> 00:06:23,630
And then open and close the class by using these curly braces.

103
00:06:23,880 --> 00:06:25,950
So as you can see it's going to show me an error again.

104
00:06:25,950 --> 00:06:32,880
So let's see what's this error the public type animal must be defined in its own form.

105
00:06:33,120 --> 00:06:38,850
So as you can see we cannot actually use public time modifier here again.

106
00:06:39,060 --> 00:06:44,800
I'm going to actually tell you more about the public modifier later in this section.

107
00:06:44,820 --> 00:06:53,210
But for now I just want to teach you how these are public you modify your behavior in against classes.

108
00:06:53,220 --> 00:06:53,920
OK.

109
00:06:54,450 --> 00:06:57,670
Now I'm going to teach you and other answers about classes.

110
00:06:57,870 --> 00:07:00,560
So first let's open the mike less that Jarba.

111
00:07:00,840 --> 00:07:05,240
And as you can see here we need to change the class name to my class.

112
00:07:05,400 --> 00:07:07,150
And now the error is caught.

113
00:07:07,430 --> 00:07:14,030
And this closing curly brace as you can see here this is the end of the class declaration.

114
00:07:14,250 --> 00:07:18,930
So as I said before we can create our own limited classes in our Java files.

115
00:07:18,930 --> 00:07:25,390
So for example if I want to create another class named sport I can do it this way.

116
00:07:25,530 --> 00:07:27,370
Class sport.

117
00:07:27,570 --> 00:07:31,790
I need to open and close my class by using these curly braces.

118
00:07:31,860 --> 00:07:39,730
For example if I want to actually create another main method here I can actually type in public case

119
00:07:39,890 --> 00:07:44,960
tatic.

120
00:07:45,120 --> 00:07:50,890
And as you can see we can have our main method for every class that we create.

121
00:07:50,940 --> 00:07:57,930
OK artics OK arguments and then I need to open and close my method by using these curly braces.

122
00:07:57,970 --> 00:08:06,660
So inside this method I want to for example I put some results to the console so I can take in system

123
00:08:07,500 --> 00:08:16,570
that out that princeling this system that out of that Cridland is the job was to actually outwitting

124
00:08:16,600 --> 00:08:19,090
your texts to the council.

125
00:08:19,120 --> 00:08:22,990
OK and I'll teach you more about these classes these methods.

126
00:08:22,990 --> 00:08:32,050
But for now just memorize this and know that this is just a way to actually outputting your texts to

127
00:08:32,050 --> 00:08:33,230
the council.

128
00:08:33,250 --> 00:08:33,830
OK.

129
00:08:33,980 --> 00:08:42,010
So inside the parenthesis I can't say I've been high for sports.

130
00:08:43,160 --> 00:08:47,590
And at the end of my statement I need to put in the semi-colon.

131
00:08:47,790 --> 00:08:51,540
And here again I can actually the type system.

132
00:08:51,670 --> 00:08:54,760
That's how it got trained to learn.

133
00:08:55,350 --> 00:09:08,130
And inside the practices I kept typing Hi from my class as you can see I am typing the name of the class

134
00:09:08,130 --> 00:09:08,860
here.

135
00:09:09,270 --> 00:09:14,260
So let's first run these actually application.

136
00:09:14,340 --> 00:09:23,930
So I just need to Right-Click underclasses project and run as Java application.

137
00:09:24,000 --> 00:09:26,090
So let's see what we have got here.

138
00:09:26,340 --> 00:09:30,930
As you can see these are the classes that we have created earlier.

139
00:09:30,980 --> 00:09:31,570
OK.

140
00:09:31,680 --> 00:09:32,670
This is the card class.

141
00:09:32,670 --> 00:09:36,830
This is the my class class and this and this is the Sports Class.

142
00:09:36,900 --> 00:09:37,440
OK.

143
00:09:37,440 --> 00:09:42,360
So for example if I want to run this sports class I just need to choose this sports class and cricket.

144
00:09:42,360 --> 00:09:43,110
OK.

145
00:09:43,320 --> 00:09:46,160
So as you can see it is going to show me high from sport.

146
00:09:46,230 --> 00:09:46,990
It's going to run.

147
00:09:47,010 --> 00:09:53,070
It's going to actually go inside the sport class and it's going to Randy's main method and inside the

148
00:09:53,160 --> 00:09:59,530
main effect it's going to execute with this statement system that out that principle and high from sports.

