In this paper, we make the first attempt to adopt the boundary integrated neural networks (BINNs) for the numerical solution of two-dimensional (2D) elastostatic and piezoelectric problems. The proposed BINNs combine the artificial neural networks with the exact boundary integral equations (BIEs) to effectively solve the boundary value problems based on the corresponding partial differential equations (PDEs). The BIEs are utilized to localize all the unknown physical quantities on the boundary, which are approximated by using artificial neural networks and resolved via a training process. In contrast to many traditional neural network methods based on a domain discretization, the present BINNs offer several distinct advantages. Firstly, by embedding the analytical BIEs into the learning procedure, the present BINNs only need to discretize the boundary of the problem domain, which reduces the number of the unknowns and can lead to a faster and more stable learning process. Secondly, the differential operators in the original PDEs are substituted by integral operators, which can effectively eliminate the need for additional differentiations of the neural networks (high-order derivatives of the neural networks may lead to instabilities in the learning process). Thirdly, the loss function of the present BINNs only contains the residuals of the BIEs, as all the boundary conditions have been inherently incorporated within the formulation. Therefore, there is no necessity for employing any weighting functions, which are commonly used in most traditional methods to balance the gradients among the different objective functions. Extensive numerical experiments show that the present BINNs are much easier to train and can usually provide more accurate solutions as compared to many traditional neural network methods.