Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Object oriented programming

Understanding class:
                                    The class is at the core of java. It is the logical construct upon which the entire java language is built because it defines the shape and nature of an object. Any concept you wish to implement in a java program must be encapsulated within a class. The most important thing to understand about a class is that it defines a new data type. Once defined, this new type can be used to create objects of that type. We can say that a class is template for an object, and an object is an instance of a class. A class is declared by the use of class keyword. Classes can (and usually do) get much more complex. The general form of a class is:

class class-name
{
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
}
}

The data or variables defined within a class are called instance variables. The code is contained within methods. Collectively, the methods and variables defined within a class are called members of the class. Thus it is the methods that determine how a class data can be used. Notice that the general form of a class does not specify a main() method. Java classes do not need to have a main() method.
Share