Results 1 to 2 of 2
- 01-23-2011, 12:24 AM #1Member
- Join Date
- Jan 2011
- Rep Power
Who can explain what and why "Classes" are needed in Java? Simplest way possible.
Hi, I'm new so go easy ^_^,
I have read through books and tried codingmyself, I can't wrap my head around "WHY" classes are needed in Java and what do they do?
Doesn't the main method do everything anyway? Can't you just tell the main method what to do and everything would work from there?
Then why is "Aggregation", "Composition" and "Inheritance" needed? Why can't we just add it in to the superclass?
It seems that Java just makes itself so complex when matters can be done through the main methods. It seems that the classes are useless?
Please explain to me what and why are Classes used in Java. What do they do? What are the getter and setter methods? What do they get? And what do they set?
What are constructors? Why can't we just initialise a variable and end it at that?
Please help me! I am so confused!
Thank you so much,
Classes aren't needed, nothing is needed, and in fact you could create as complex and beautiful a program as you desire using just assembly language, but the difficulty doesn't arise so much in getting computers to understand your program, rather the difficulty comes in having us, humans understand the program, and to help ease that, it has been found that subdividing programs into separate functioning units is beneficial (structured programming), and that linking data and code together, hiding parts of data and code that don't need to be exposed and yes even inheritance can make it easier for humans to understand code.
- By goldest in forum New To JavaReplies: 6Last Post: 08-10-2010, 09:22 AM
- By mr_anderson in forum Advanced JavaReplies: 1Last Post: 08-02-2010, 07:18 AM
- By sk8rsam77 in forum New To JavaReplies: 11Last Post: 02-26-2010, 04:03 AM
- By mrblue in forum New To JavaReplies: 4Last Post: 06-26-2009, 08:23 PM
- By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM