Finite p-groups of nilpotency class 2 are treated from the perspective of central extensions. Given finite abelian groups G, A, we derive an explicit formula for cocycles representing elements of \(H^2(G,A)\) , compute \(H^2(G,A)\) , and describe the actions of \(\textrm{End}(G)\) and \(\textrm{End}(A)\) on \(H^2(G,A)\) . These are used to provide an efficient criterion for lifting endomorphisms of G to homomorphisms between two central extensions. Subsequently, we present two applications to illustrate the usefulness of this approach, in the case \(p>2\) . First, we recover the classification of two-generator p-groups of class 2 up to isomorphism, and compute the order of the automorphism group for each isomorphism class. Second, we construct a family of nonabelian p-groups of order \(p^7\) whose automorphism groups are abelian.