Almost, if not all, military projects start out their lives as classified in some way. Restricted to just those people working on them, inside the company. Even other employees of the defence company won't know it's taking place in most cases. Then it'll get published at some point, deliberately or accidentally, and the world will know. At least, it will know the published facts. Because the classification will simply drop a little: need to know within the company, national secret, organisation secret (e.g. NATO), before non-secret. And that won't be for every fact, only the ones they allow. There are many "public" military programmes where I'd put money on there being some restricted information that isn't actually in public domain: ranges, capabilities etc.
You only have to look at some of the famous "black" programmes of recent decades to see that there may be years (or even decades) of concept, design, development and production, testing and, in some really secret cases, deployment (internationally?), before the official announcement of existence is even made: SR-71, F-117, B-2 etc2. I suppose go back far enough and look at radar and sonar (though there was a war on at the time).