Experimental demonstration of the criterion for the prepare-and-measure nonclassicality