Forums Java Help How to define classes in Java programming

This topic contains 1 reply, has 2 voices, and was last updated by  juwanine 6 years, 7 months ago.

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 6 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.