Tell the difficulties that i am difficult.
saloni jhanwar wrote:Rule>> Files with no public classes can have a name that does not match any of the classes in the file.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
So, if a file doesn't contain any public class, its name can be any valid file name.
Tell the difficulties that i am difficult.
saloni jhanwar wrote:
Anayonkar Shivalkar wrote:
So, if a file doesn't contain any public class, its name can be any valid file name.
When I tried different name other than non public classes, then my program doesn't run with that, then what is use to put different name and why should i use.Thanks
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
Tell the difficulties that i am difficult.
Anayonkar Shivalkar wrote:What do you mean by 'program doesn't run'? Have you written your main method in non-public class? If yes, then it won't work.
saloni jhanwar wrote:When I tried different name other than non public classes, then my program doesn't run with that, then what is use to put different name and why should i use.Thanks
Norbert Muench wrote:Not true. The following will compile and run fine, although the main method is not in a public class:
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
Norbert Muench wrote:Not true. The following will compile and run fine, although the main method is not in a public class:
Yes. You are right.
Tell the difficulties that i am difficult.
Norbert Muench wrote:
saloni jhanwar wrote:When I tried different name other than non public classes, then my program doesn't run with that, then what is use to put different name and why should i use.Thanks
What do you mean by that? If I take your example code above and save it in a file called foo.java, the code will compile and run without problems.
Tell the difficulties that i am difficult.
saloni jhanwar wrote:
Hi Norbert
You didn't get my point, yes above code will work fine ,because you are compiling file using source file name while interpreting using class name that is different scenario but i asked that if i interpret also using same source file name ? then it wont work.
saloni jhanwar wrote:Hi Anayonkar Shivalkar
You were giving me wrong knowledge that is not good .Every greenhorn posts doubts here to get clarification not to get more confused.This all will lead to frustrating about this forum.
Norbert Muench wrote:
Now come on, this hardly seems fair. Anayonkar just tried to help you and made an honest mistake. That can happen to everyone. I think you should apologise to him.
The lesson to take away here is that you should always verify the answers you get, instead of blindly accepting them. In this concrete example you could have noticed, that Anayonkars answer actually contradicts your findings in your first post in this thread.
Tell the difficulties that i am difficult.
saloni jhanwar wrote:You were giving me wrong knowledge that is not good
I guess I am correct with this statement.Anayonkar Shivalkar wrote: So, if a file doesn't contain any public class, its name can be any valid file name.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
saloni jhanwar wrote:You were giving me wrong knowledge that is not good
My apologies. It was not intentional, and I should've confirmed it before posting in forum.
Tell the difficulties that i am difficult.
saloni jhanwar wrote:
Norbert Muench wrote:
Now come on, this hardly seems fair. Anayonkar just tried to help you and made an honest mistake. That can happen to everyone. I think you should apologise to him.
The lesson to take away here is that you should always verify the answers you get, instead of blindly accepting them. In this concrete example you could have noticed, that Anayonkars answer actually contradicts your findings in your first post in this thread.
I'm beginner and as any beginner if I've confusion in some topic and someone explain that this will be correct then I've to accept it regardless that is actually right or wrong because i've been already confused. Anyways i won't apologies because i'm not wrong.thanks
Jeff Verdegan wrote:
saloni jhanwar wrote:
Norbert Muench wrote:
Now come on, this hardly seems fair. Anayonkar just tried to help you and made an honest mistake. That can happen to everyone. I think you should apologise to him.
The lesson to take away here is that you should always verify the answers you get, instead of blindly accepting them. In this concrete example you could have noticed, that Anayonkars answer actually contradicts your findings in your first post in this thread.
I'm beginner and as any beginner if I've confusion in some topic and someone explain that this will be correct then I've to accept it regardless that is actually right or wrong because i've been already confused. Anyways i won't apologies because i'm not wrong.thanks
Yes, you were wrong. Anayonkar Shivalkar is a knowledgeable and helpful individual. He made a simple, honest mistake, just like you do and I do and everybody does every single day. There was no call to attack him like you did. And his mistake was quickly pointed out and corrected. That's one of the great things about a public forum like this, is that even if somebody posts something incorrect, somebody else will probably see it and correct it. (Just like I corrected your inaccurate post about heap and stack a few minutes ago.)
Additionally, the idea that "I've to accept it regardless that is actually right or wrong" is wrong. You need to apply your own intelligence and judgment to everything you read.
Tell the difficulties that i am difficult.
Jeff Verdegan wrote:Anayonkar Shivalkar is a knowledgeable and helpful individual.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
Jeff Verdegan wrote:Anayonkar Shivalkar is a knowledgeable and helpful individual.
Thanks Jeff Verdegan It feels nice when someone like you says that.
As the question in original post has been answered, let's cool down now
Tell the difficulties that i am difficult.
saloni jhanwar wrote:hmm I think, you had reported about this that's why he posted this all.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:
saloni jhanwar wrote:hmm I think, you had reported about this that's why he posted this all.
No. I didn't report it - because there was a mistake in my post and that is why I clearly apologized about that. Frankly speaking, I wouldn't make such guess. I don't know why you feel/guess that way.
Tell the difficulties that i am difficult.