E:\Programs>javac abc.java [abc is java filename]
E:\Programs>java ClassIsNotPublic [ClassIsNotPublic is java classname]
What will happen if we take non public class This class is not public so
we can take different name for the java filename and java classname
Why it is not public class This class is not prefixed with public keyword
that's why it is not public
E:\Programs>javac xyz.java
xyz.java:1: error: class IfClassIsPublic is public, should be
declared in a file named IfClassIsPublic.java
public class IfClassIsPublic{
^
1 error
歡迎光臨 艾歐踢論壇 (http://www.iot.idv.tw/ucenter/) | Powered by Discuz! X3.2 |