Classes and Objects in Java MCQ Quiz
A class in java defines a new data type. Once defined, this new type can be used to create objects of that type. Thus, a class is a template for an object, and an object is an instance of a class. Because an object is an instance of a class, you will often see the two words object and instance used interchangeably.
When you define a class, you declare its exact form and nature. You do this by specifying the data that it contains and the code that operates on that data. While very simple classes may contain only code or only data, most real-world classes contain both. A class’s code defines the interface to its data. A class is declared by the use of the class keyword. Classes can (and usually do) get much more complex. A simplified general form of a class definition is shown here:
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
}
}
Quiz Description:Â
Name: Classes and Objects in Java MCQ Quiz
Subject:Â Java
Topic: Classes and Objects
Questions: 15 Objective Type Questions
Time Allowed: 15 Minutes
Language:Â English
Important for: Â B. Tech. / M. Tech. Students, B.Sc. / M.Sc. (CS / IT) and aspirants of I.E.S. and other competitive exams, computer science job interviews, Java job interviews, etc.
Created By: Esha Tripathi






