1
00:00:00,210 --> 00:00:00,780
Hi.

2
00:00:00,800 --> 00:00:01,990
It is this theater.

3
00:00:02,190 --> 00:00:04,310
I want to talk about a string format.

4
00:00:04,350 --> 00:00:05,090
OK.

5
00:00:05,310 --> 00:00:07,890
So first we need to create a Java project.

6
00:00:07,890 --> 00:00:12,520
So just click on this file new and then click on Java project.

7
00:00:12,540 --> 00:00:13,300
OK.

8
00:00:13,650 --> 00:00:18,300
And for the project name just type in here a thrain format.

9
00:00:18,660 --> 00:00:19,340
OK.

10
00:00:19,680 --> 00:00:23,810
And then click on finish and we need a main class for our project.

11
00:00:23,820 --> 00:00:30,760
So just click on the RC folder and then click on File New and then click on class.

12
00:00:30,810 --> 00:00:38,160
So for the class name just type in here Main and then click for the package name.

13
00:00:38,160 --> 00:00:44,530
Just type in here com that your name dot product name OK.

14
00:00:44,790 --> 00:00:47,390
A strange format.

15
00:00:47,930 --> 00:00:48,560
OK.

16
00:00:48,720 --> 00:00:51,910
And for the modifiers choose public.

17
00:00:52,230 --> 00:00:53,430
And for the.

18
00:00:53,520 --> 00:00:58,350
And here make sure that we've checked the search box here that says public static void main method.

19
00:00:58,350 --> 00:00:58,880
OK.

20
00:00:59,010 --> 00:01:00,640
And then click Finish.

21
00:01:00,810 --> 00:01:03,550
So as you can see here our main class is now created.

22
00:01:03,600 --> 00:01:08,770
And then I double click on this main that job I have here in order to make this editor area wider.

23
00:01:09,210 --> 00:01:13,760
So now I want to talk about a string format in Java.

24
00:01:13,790 --> 00:01:18,860
OK so what is string formats.

25
00:01:19,590 --> 00:01:28,090
First of all let me point out that sometimes we need to compose strings from valuables like integers.

26
00:01:28,110 --> 00:01:28,720
OK.

27
00:01:28,920 --> 00:01:33,950
And other text string that format is ideal here.

28
00:01:34,020 --> 00:01:38,750
It provides a format language to which we add value of else.

29
00:01:38,940 --> 00:01:45,140
OK so now I'll show you more examples in order to make this concept more meaningful for you to insert

30
00:01:45,150 --> 00:01:49,140
numbers we can use that letter to the format.

31
00:01:49,170 --> 00:01:58,320
OK we use ordinals after the initial per cent symbol starting at 1 and increasing.

32
00:01:58,500 --> 00:02:01,500
This indicates which argument to insert.

33
00:02:01,560 --> 00:02:02,180
OK.

34
00:02:02,320 --> 00:02:05,280
So for the integers we use the format.

35
00:02:05,290 --> 00:02:08,080
OK so now let me just type in here.

36
00:02:08,200 --> 00:02:15,760
Strange that format and as you can see here we need to pass values to this method.

37
00:02:15,790 --> 00:02:18,450
Ok this method accepts arguments.

38
00:02:18,490 --> 00:02:27,810
Ok the first argument is a strain that describes the desired formatting of the output from then on these

39
00:02:27,900 --> 00:02:36,600
arguments can have a multiple number of arguments of any type at runtime these arguments will be converted

40
00:02:36,870 --> 00:02:42,790
to strange and will be printed according to the formatting instructions.

41
00:02:42,830 --> 00:02:47,960
OK so now I want to show you the most basic rule that string formatting follows.

42
00:02:48,060 --> 00:02:48,940
OK.

43
00:02:49,230 --> 00:02:54,030
So as you can see here this is the most basic rule that string formatting follows.

44
00:02:54,040 --> 00:02:58,340
Ok so first of all we need to put the percent sign.

45
00:02:58,430 --> 00:03:06,750
OK so the person sign is a special character denoting that a formatting instruction follows.

46
00:03:06,750 --> 00:03:16,500
So let me repeat again this person sign here is a special character denoting that of formatting an instruction

47
00:03:16,620 --> 00:03:17,350
follows.

48
00:03:17,430 --> 00:03:29,100
And the second one is argument index OK argument index as against Sahir argument index explicitly denoted

49
00:03:29,580 --> 00:03:33,010
the index of the arguments to be formatted.

50
00:03:33,030 --> 00:03:41,910
OK if it is not present arguments will be formatted in the same order as they appear in the arguments

51
00:03:41,910 --> 00:03:49,260
list this argument index explicitly denoted the index of the arguments to be formatted.

52
00:03:49,270 --> 00:03:57,660
OK if it is not present arguments will be formatted in the same order as they appear in the arguments

53
00:03:57,660 --> 00:04:00,730
list the next one is flat.

54
00:04:00,840 --> 00:04:01,140
OK.

55
00:04:01,140 --> 00:04:06,400
As you can see here flag is a special formatting instruction for example.

56
00:04:06,450 --> 00:04:15,990
Plus flag specifies that a numeric value should always be formatted with a sign and the zero flag specifies

57
00:04:16,200 --> 00:04:22,360
that 0 is the Padden character and the next one is Viets as you can see here.

58
00:04:22,490 --> 00:04:23,560
OK.

59
00:04:23,580 --> 00:04:29,240
With the denotes the minimum number of output characters for that object.

60
00:04:29,370 --> 00:04:38,320
OK so now let me repeat again with the nodes the minimum number of output characters for that object.

61
00:04:38,700 --> 00:04:39,270
OK.

62
00:04:39,270 --> 00:04:42,650
And the next one is Dadds precision.

63
00:04:42,690 --> 00:04:47,550
This denotes the precision of floating point numbers in the outputs.

64
00:04:47,640 --> 00:04:54,180
That is basically the number of decimal digits you wish to print on the output but it can be used for

65
00:04:54,240 --> 00:04:57,920
other types to truncate the output with.

66
00:04:58,130 --> 00:04:58,860
OK.

67
00:04:58,890 --> 00:04:59,800
And the next one.

68
00:05:00,030 --> 00:05:09,150
Type R-Ga. type B 8 percent are the only mandatory formatting arguments type simply denotes the type

69
00:05:09,150 --> 00:05:13,650
of the object that will be formatted in the outputs for integers.

70
00:05:13,650 --> 00:05:22,410
That is the four strings that is best for floating point numbers that is F for integers with hex format

71
00:05:22,620 --> 00:05:24,080
that is x.

72
00:05:24,100 --> 00:05:27,760
Ok so now I want to show you some real examples.

73
00:05:27,960 --> 00:05:29,850
And then and then this can actually make sense for you.

74
00:05:29,850 --> 00:05:30,300
OK.

75
00:05:30,330 --> 00:05:32,160
So now I want to actually create.

76
00:05:32,160 --> 00:05:35,610
So now let me actually comment out this line of code here.

77
00:05:35,820 --> 00:05:38,450
In order to let the compiler to run my code.

78
00:05:38,550 --> 00:05:41,850
And now I want to actually create a string object.

79
00:05:41,970 --> 00:05:42,790
So there.

80
00:05:42,920 --> 00:05:49,430
So first I need to refer to the string class as strange and that the name of my object is a string.

81
00:05:49,440 --> 00:05:50,680
Result.

82
00:05:51,290 --> 00:05:52,370
OK.

83
00:05:53,220 --> 00:05:58,880
And then I put in an assignment operator here and then I refer to the name of the string class.

84
00:05:58,900 --> 00:06:02,150
A strange dot format.

85
00:06:02,790 --> 00:06:07,690
And as you can see here here we need to actually specify the formatting instructions.

86
00:06:07,830 --> 00:06:11,810
And our second argument is going to actually accept our real values.

87
00:06:12,030 --> 00:06:15,740
Ok so here we need to actually specify the formatting instruction.

88
00:06:15,890 --> 00:06:23,550
So I need to put in two double quotes here and then inside the double quotes I can actually specify

89
00:06:23,550 --> 00:06:26,620
the formatting instruction for my string of object.

90
00:06:26,650 --> 00:06:27,030
OK.

91
00:06:27,060 --> 00:06:31,930
So here I want to actually typing integer percent.

92
00:06:31,930 --> 00:06:35,050
D city is the type of our string formatting.

93
00:06:35,190 --> 00:06:39,950
So person sign and the type are the only mandatory formatting arguments.

94
00:06:39,960 --> 00:06:40,410
OK.

95
00:06:40,440 --> 00:06:47,860
And then I want to actually specify a new line character by using dislike for the slash character plus.

96
00:06:47,930 --> 00:06:48,390
And.

97
00:06:48,540 --> 00:06:49,160
OK.

98
00:06:49,350 --> 00:06:56,670
And then I press on tab key on my keyboard and then I can actually passing my values for example number

99
00:06:56,680 --> 00:06:57,460
58.

100
00:06:57,510 --> 00:06:58,080
OK.

101
00:06:58,260 --> 00:07:01,550
And that I need to put in a semi-colon at the end of my statement.

102
00:07:01,620 --> 00:07:02,260
OK.

103
00:07:02,490 --> 00:07:07,500
And now I want to output this string result object to the console.

104
00:07:07,560 --> 00:07:15,780
So I just need to type in here or system that out does princeling and then inside the prentices I just

105
00:07:15,780 --> 00:07:20,200
need to refer to the name of the to the name of the string with that object.

106
00:07:20,460 --> 00:07:23,910
And then I need to put in a semicolon at the end of my statement.

107
00:07:24,030 --> 00:07:29,780
And now if I go on my project as you can see it's going out with this value to the console OK.

108
00:07:29,790 --> 00:07:37,590
So as you can see here first of all I specified the formatting instructions for my value as you can

109
00:07:37,590 --> 00:07:38,100
see here.

110
00:07:38,130 --> 00:07:42,600
Integer call 1 percent type.

111
00:07:42,930 --> 00:07:45,030
And this is the newline character OK.

112
00:07:45,270 --> 00:07:51,050
So for example if you want to actually output another value to the console Let's see what happens.

113
00:07:51,060 --> 00:07:58,320
System that out that princeling and then inside the prentices are just put two double codes that in

114
00:07:58,320 --> 00:08:02,890
some text here and then I need to put in a semicolon at the end of my statement.

115
00:08:03,190 --> 00:08:07,350
And if I had on my project now as you can see it's going to actually put this text here.

116
00:08:07,370 --> 00:08:09,300
OK below this value.

117
00:08:09,360 --> 00:08:15,870
OK but if we don't actually put this new line together here and if I don't my project now as you can

118
00:08:15,870 --> 00:08:18,380
see it's going to put this value here.

119
00:08:18,390 --> 00:08:18,920
OK.

120
00:08:19,050 --> 00:08:24,280
So this near-light you can actually put a space between these two values.

121
00:08:24,350 --> 00:08:30,900
Ok so now let me show you another example about floating point numbers.

122
00:08:30,900 --> 00:08:38,880
So first let me actually comment out these lines of code here and now again I want to create a string

123
00:08:38,940 --> 00:08:39,730
object.

124
00:08:39,780 --> 00:08:48,340
So first I need to refer to the String class as strange and the name of the object is.

125
00:08:48,340 --> 00:08:49,670
Strange.

126
00:08:50,460 --> 00:08:51,050
OK.

127
00:08:51,150 --> 00:08:57,590
And then we need to put in an assignment operator here and then we need to refer to this in class strength

128
00:08:57,590 --> 00:08:59,620
that format.

129
00:09:00,090 --> 00:09:06,240
And here first of all we need to specify formatting instructions OK for our object.

130
00:09:06,270 --> 00:09:09,940
We need to put it into double quotes and then inside it calls.

131
00:09:10,020 --> 00:09:12,710
Now I can specify the formatting instructions.

132
00:09:12,720 --> 00:09:13,330
OK.

133
00:09:13,560 --> 00:09:20,740
So a floating or floating point number with Freet decimal digits.

134
00:09:20,850 --> 00:09:28,680
And then I just put in a colon here colon here and then I put a space here and then I can specify the

135
00:09:28,680 --> 00:09:30,370
formatting instruction.

136
00:09:30,570 --> 00:09:36,270
And then I can specify the formatting Kear percent point free

137
00:09:39,530 --> 00:09:47,390
back for Slash and so as you can see here first I put the percent character here as you can see here.

138
00:09:47,670 --> 00:09:50,130
First Vinita putting this person's character.

139
00:09:50,390 --> 00:09:59,450
And then we can specify the argument index flag or the data precision and the type but the person's

140
00:09:59,660 --> 00:10:04,470
character and that height is mandatory for our formatting arguments.

141
00:10:04,490 --> 00:10:04,940
OK.

