Achari Chintaluri wrote:I am able to run this program in Command.
Really? I don't believe that, because this program doesn't even compile.
The character ^ is not a valid character that you can use in identifiers in Java (class names, method names, variable names etc.). Paragraph 3.8 of the Java Language Specification explains what characters you can and cannot use in identifiers.
See this. The caret character (^) is a CMD.EXE escape character and it is ignored in this case. You're actually executing Page5.class in both cases. Hint: there is no Page^5.class in your listing - Page^5.java was never successfully compiled.
Look at the compiler output. That would give you more authoritative answer.