Welcome to the Classes and Methods MCQs Page
Dive deep into the fascinating world of Classes and Methods with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Classes and Methods, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Classes and Methods, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.
Check out the MCQs below to embark on an enriching journey through Classes and Methods. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Classes and Methods. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Classes and Methods MCQs | Page 12 of 30
Explore more Topics under Java Programming
class test
{
int a;
int b;
void meth(int i , int j)
{
i *= 2;
j /= 2;
}
}
class Output
{
public static void main(String args[])
{
test obj = new test();
int a = 10;
int b = 20;
obj.meth(a , b);
System.out.println(a + " " + b);
}
}
class test
{
int a;
int b;
test(int i, int j)
{
a = i;
b = j;
}
void meth(test o)
{
o.a *= 2;
O.b /= 2;
}
}
class Output
{
public static void main(String args[])
{
test obj = new test(10 , 20);
obj.meth(obj);
System.out.println(obj.a + " " + obj.b);
}
}
class static_out
{
static int x;
static int y;
void add(int a, int b)
{
x = a + b;
y = x + b;
}
}
class static_use
{
public static void main(String args[])
{
static_out obj1 = new static_out();
static_out obj2 = new static_out();
int a = 2;
obj1.add(a, a + 1);
obj2.add(5, a);
System.out.println(obj1.x + " " + obj2.y);
}
}
class static_out
{
static int x;
static int y;
void add(int a , int b)
{
x = a + b;
y = x + b;
}
}
class static_use
{
public static void main(String args[])
{
static_out obj1 = new static_out();
static_out obj2 = new static_out();
int a = 2;
obj1.add(a, a + 1);
obj2.add(5, a);
System.out.println(obj1.x + " " + obj2.y);
}
}
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");
}
}
class Output
{
public static void main(String args[])
{
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}
class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length());
}
}
class string_class
{
public static void main(String args[])
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
obj2 = " world";
System.out.println(obj + " " + obj2);
}
}
class string_class
{
public static void main(String args[])
{
String obj = "hello";
String obj1 = "world";
String obj2 = "hello";
System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));
}
}
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!