0% found this document useful (0 votes)
50 views1 page

Java Programming (Theory) Assignment 2

This document contains 10 questions about Java programming concepts. Question 1 asks about method overloading and gives an example program to demonstrate ambiguity. Question 2 asks about the difference between method overloading and overriding with an example. Question 3 asks to write a program to check if a number is a palindrome. The remaining questions cover additional Java topics like arrays, matrices, inheritance, the super keyword, constructor overloading, inner classes, abstract classes, interfaces, and access modifiers.

Uploaded by

Mohammad saheem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views1 page

Java Programming (Theory) Assignment 2

This document contains 10 questions about Java programming concepts. Question 1 asks about method overloading and gives an example program to demonstrate ambiguity. Question 2 asks about the difference between method overloading and overriding with an example. Question 3 asks to write a program to check if a number is a palindrome. The remaining questions cover additional Java topics like arrays, matrices, inheritance, the super keyword, constructor overloading, inner classes, abstract classes, interfaces, and access modifiers.

Uploaded by

Mohammad saheem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Java Programming (Theory)

Assignment 2
Q1. What will be the output of this program. Explain with the help of an example.

class Adder{
static int add(int a,int b){return a+b;}
static double add(int a,int b){return a+b;}
}
class TestOverloading3{
public static void main(String[] args){
System.out.println(Adder.add(11,11));//ambiguity
}}
Q2. Difference between method overloading and overriding with the help of an example.
Q3. Write a simple java program to check whether a number is palindrome or not.
Q4. Write a java program to print even and odd numbers from an array.
Q5. Write a java program to check whether two matrices are equal.
Q6. Java program to illustrate the concept of single inheritance (create a base class employee
and then create its subclasses).
Q7. Where is super keyword used in java? Explain it’s use in the previous example.
Q8. Create a class Box and use constructor overloading to calculate the volume of a box
object that takes
a. No initial dimensions
b. Length, breadth and width as its initial dimensions
c. Length (a cubic box is created)
Q9. Write simple programs to explain each of the following terms:
a. Inner class
b. Abstract class
c. Interface
Q10. Explain the use of various access modifiers using a single program.

You might also like