00:01
Hello, welcome to this lesson.
00:02
In this lesson, we will write a java program that accepts two integers from the command line and we print the assignment.
00:10
So let's have the entry point the public static void main, that's the main method.
00:20
And now these two integers will actually be a list of of strength, right? alice of strength that has to increase, right? so let's check what whether or not the entries actually to so i'm going to say if the length of the entries from the command line is less than two, then i'm simply going to say, please input the integers i'm going to say, please input the integers, then i would return.
01:11
If the length is no less than two, in other sense, if we have to integers put on the command line, then we're simply going to use a try catch, because i'm passing strings, an array of string to an integer, right? so i'm casting them.
01:37
And there's a probability that user would put in something which is not an integer, right? so i'm going to catch a section.
01:49
So here, i'm making a general exception, there could be something else apart from the entries not being integers.
02:01
So i'm simply going to say system without print.
02:08
And i'm going to say, check and put in integers.
02:18
Alright, alright.
02:31
If everything is successful, i'm going to actually have to variables declined as the so i'll have the integer, the pass it here, because i'll have an array of two strings, alright, i'm going to get the first one to be the first integer, the second one to be the second say x zero, one of the zero in this, then ntb, this will be integer, i'm casting the string, which will be on the command line to an integer.
03:21
Alright.
03:22
So say x, that's in this one, there will be the second argument, there will be on the the second integer argument that would be on the array list.
03:39
So i'm simply going to declare results or said, 10 variable, which will hold a sum of the two.
03:55
Now say, the sum of the two integers, we'll say, the sum of a, b is the output in the results...