Results 1 to 2 of 2
  1. #1
    Zukky is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default 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,


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    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.

Similar Threads

  1. Replies: 6
    Last Post: 08-10-2010, 10:22 AM
  2. setting the "Java classes" directory in Linux
    By mr_anderson in forum Advanced Java
    Replies: 1
    Last Post: 08-02-2010, 08:18 AM
  3. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 04:03 AM
  4. Plz explain "Interface"
    By mrblue in forum New To Java
    Replies: 4
    Last Post: 06-26-2009, 09:23 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts