It may also be possible to drink milk through your nose but why in the world would you want to do that? Just to see if you can? Why not put your time and effort into learning how to do something useful with Java instead?
The best ideas are the crazy ones. If you have a crazy idea and it works, it's really valuable.—Kent Beck
Yeah, you can't really make a Java program completely without the use of a class. Java is a pure object-oriented language, and every last thing that goes on in it happens within a class (counting stuff that uses different keywords).
C++, of course, is a hybrid language between the procedural and OO paradigms. Its main function goes outside of a class (still counting stuff that uses different keywords, but not including enums in this case), and classes are basically optional.
I ADAMANTLY disagree with the notion that this question is irrelevant. To be good at programming in a certain language, you need to have a pretty solid idea of what that language's rules are. Even obscure, obviously, and seemingly irrelevant knowledge of the rules can come in handy. I mean, Java programmers need to know that the main function has to be put in a class of some sort. He/she's asking for clarity on that point, which is VERY relevant.
John McClellan wrote:Java is a pure object-oriented language, ...
The question "Is Java a pure OO language?" is one of those frequently asked questions here (presumably because it's often asked in job interviews or for school exams) and the answer to the question is not as clear cut as you think. There isn't an exact definition of what "pure OO language" means. Some people say that Java is not a pure OO language because not everything is an object in Java (primitives are not objects).
John McClellan wrote:To be good at programming in a certain language, you need to have a pretty solid idea of what that language's rules are. Even obscure, obviously, and seemingly irrelevant knowledge of the rules can come in handy. I mean, Java programmers need to know that the main function has to be put in a class of some sort. He/she's asking for clarity on that point, which is VERY relevant.
And I'm afraid I ADAMANTLY disagree with:
(a) That statement.
(b) The idea that a beginner is likely to be a good arbiter of what's relevant or useful.
I've spent too long answering questions from people in their first weeks/months of the Java learning process who want to know exactly where objects are stored in memory, or when to call the garbage collector, or how hashmaps work internally, or why stupid Java does such-and-such to have a lot of faith in their ability to discern what IS and what is NOT relevant.
Many questions that aren't relevant when you're 6 weeks into a course may become relevant later on, when you have the requisite knowledge to digest the answers. Based on what I've read in this thread, I'm with Bear and Junilu.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Dinner will be steamed monkey heads with a side of tiny ads.
SKIP - a book about connecting industrious people with elderly land owners