Count the number of cubes that fill the rectangular prism. It has twelve cubes in the bottom layer and twelve cubes in the top layer, so it is composed of 24 cubes altogether. Because each of these cubes is one cubic inch, the rectangular prism has a volume of 24 cubic inches.