 Hello everyone. Myself Professor Preeti Stikte, working in Mechanical Engineering Department, WIT, Singapore. Today we will discuss the classes, objects, and methods part 2. The learning outcomes are students will be able to explain concepts regarding classes, objects, and methods. Also the students will be able to develop Java source codes with the help of applications of classes, objects, and methods. The contents are, first we will discuss the recap of first session and after that we will take the program based on the applications of classes, objects, and methods. Now we will see the two methods that we have discussed in the session 1. Gate data method and rect area method which consists of the declaration of the variables. So parameter list means the variables which consist of the type wide, the method name as a gate data where the length and width are the variables. The method 2 consists of the rect area method which consists of the formula for area of the rectangle and after that we are returning that value which will be stored in the rect area method. After combining the method 1 and method 2, so the gate data method consists of the declaration of the variables and rect area method consists of the declaration of the area of the rectangle. Object declaration consists of the declaration of the particular object and after that the initialization. These are the two steps where rectangle will be the class name, rect one will be the object name and where new will be the constructor or the parameter which will combine the class name rectangle and the rect one object name. So combining 1 and 2 we will get the rectangle rect one and is equal to new rectangle where rectangle is a class name, rect one is an object name, new is a constructor and again rectangle is a class name. Similarly for rectangle 2, rectangle rect 2 is equal to new rectangle where rect one and rect 2 are the object names for the rectangle 1 and rectangle 2. The next part is accessing the class numbers. So accessing the class members means providing the value for the variable. So this will be the first method where object name dot variable name is equal to value. This will be the general code for the to declare the value for the variable for example for rectangle 1. So rect one dot length is equal to 15 and rect one dot width is equal to 47 where rect one is an object name length and width are the variables and 15 and 47 are the values for length and width. Here we are calculating the area for the rectangle one where int A1 is equal to rect one dot length into rect one dot width where we are having the variables called as rect one dot length into rect one dot width second method. So here we are recalling the two methods that we have declared already that is gate data method and rect area method. Gate data method consists of the declaration of the variables. In general code object name dot method name in the bracket parameter list here the parameter list consists of the values for the variables. So rect two is an object name for the second rectangle dot gate data is an object sorry the method name and 30 and 60 are the values for the variables. Here 30 will be for x 60 will be for y but we have declared that x is equal to length and y is equal to width means 30 is equal to length and 60 is equal to width. Second method here we have to recall the rect area method so directly we can store that value particular value that is area for the rectangle two in the A2 variable so int A2 is equal to rect two dot rect area where rect two is an object name for the second rectangle rect area is an method we have declared already. So so values will be stored in the length and width and the calculation of the area for the rectangle two will be stored in the particular A2. Now think how to declare the object and method that we have discussed. Now we will move to the program the program statement write a program to calculate areas for the two rectangles with the applications of classes objects and methods. Now we will go to the program now we will go step by step. Here we have declared the class rectangle and class area. What class rectangle consist of the class rectangle consist of declaration of the variables and declaration of the area for the rectangle. The class area will be called as a main class because it consist of the main statement that is public static wide mainstream ARJs. So whenever we want to execute the program we have to use the main class now. So class rectangle length and width are the variables integer as a data type after that wide gate data in the bracket int x and int y where wide is a type gate data is a method int x and int y are the parameter list after that we are declaring x is equal to length and y is equal to width. Now so gate data method consist of declaration of the variables here we are not declaring any values for the length and width we are declaring the value for the variable that is also called as accessing the class member in the main class that is area after that now we have to provide the value for the variable and after that the areas for the rectangle. Now we are declaring the area for the rectangle in the rect area. So int a is equal to length into width so where integer as a data type rect area is a method name and we are storing the formula for the rectangle in the rect area method. Here the problem statement is that we have to calculate the areas for the two rectangles but here we had stored the formula for the area of rectangle that is once means we have to recall the rect area method twice and after that whenever the value will be stored in the return we are returning the value in the rect area method. Now we are moving towards the main class that is class area which consist of public static wide mainstream ASA statement integer a1 and a2 so a1 and a2 are the output variables where we are storing the areas of rectangles in the a1 and a2. Now these two statements are the object declaration statements so rectangle rect one is equal to new rectangle where rect one is an object name rectangle is a main class and new is a constructor and rectangle again the main class. So rectangle rect one is an declaration statement rect one is equal to new rectangle is an initialization statement so by combining initialization and declaration statement we are we will get the statement like rectangle rect one is equal to new rectangle where object name rect one will be for the rectangle one similarly for rectangle two rectangle rect two is equal to new rectangle where rect one and a rect two are the object name for the rectangle one and rectangle two. Now these three statements are for areas for the first rectangle. Now first method, so we have to declare the values for the variable. So we have declared the rect one as an object name dot length is a variable is equal to value. So rect one dot length is equal to 15. So this will be the value for the variable length. Similarly, rect one dot width is equal to 30 where rect one is an object name, variable is an width and 30 is the value. So the formula will be A1 is equal to rect one dot length and rect one dot width. So this will be the area for rectangle one and that will be stored in the A1. Now area for the second rectangle, area for the second rectangle. So here we are recalling the gate data method and the rect area method. Now so rect two is an object name for the second rectangle. Gate data is a method name which consists of the variable declaration and 40 and 50 are the values for the variable where x is equal to 40 and y is equal to 50. But we have declared that x is equal to length and y is equal to width means length is equal to 40 and width is equal to 50. Now the values for the variable we have declared. Now A2 is equal to rect two dot rect area. Rect two is an object name, rect area that we have declared already the method which consists of area for the rectangle. So 40 into 50 that will be the length into width and that value will be stored in the rect area. Now system dot or dot println area one is equal to plus A1. Already we have stored the values of A1 and A2 so with the help of these two statements we can store the values. So area one is equal to plus A1 and area two is equal to plus A2 with the help of these two statements we can print the values of area one and area two for the rectangle one and rectangle two. Now we will move to the execution of a program. Now we had stored the particular program on the desktop. Now first we will compile the program that is java c space the program file name that is area dot java. So this will be our compilation so java space the class name the class file will be created after the compilation java space area. So after interpretation of the program we will get the output that is area one is equal to 450 and area two will be equal to 2000. So this will be only possible with the help of applications of classes objects and methods. Now after that these are the references. Thank you.