Forums Java Help How to define classes in Java programming

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15455
    ahwriter
    Participant

    How to define classes in Java programming and which class is the superclass of all classes?

    #15457
    juwanine
    Participant

    Answer: A class is defined as the attributes and methods of objects of same type sharing common characteristics. Classes in Java programming are defined as following:

    class classname
    {
    type instance-variable1;
    type instance-variable2;

    type instance-variableN;
    type methodname1(parameter-list) {
    // body of method
    }
    type methodname2(parameter-list) {
    // body of method
    }

    type methodnameN(parameter-list) {
    // body of method
    }
    }
    java.lang.Object is the root class for all the java classes and we don’t need to extend it.

    • This reply was modified 8 years, 7 months ago by juwanine.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.