is it true
There is constraint in java while using a public , that a file with Java source code can only contain one public class whose name must also match with the filename
Yes it is.
I would have liked you to first having gone through the langauge documentation, since this is something that even the very first program requires you would have found this immediately and also learnt a few things with that. Search your question on the internet first if you do not get a satisfactory answer only then post it here.