Write a Java-program to print Max Number program using no parametarized constructor with no return type with no parametarized method

Write a Java-program to print Max Number program using no parametarized constructor with no return type with no parametarized method

Program
class MaxNumber
{
    int x,y;
    MaxNumber(int p,int q)
    {
        x=p;
        y=q;
    }
    void max()
    {
        if(x>y)
        {
            System.out.println("x is Max Number");
        }
        else
        {
            System.out.println("y is Max Number");
        }
    }
}
public class Main
{
    public static void main(String args[])
    {
        MaxNumber m=new MaxNumber(10,20);
        m.max();
    }
}

Output:

y is Max Number





More Questions


117 . Write a Java-program to print Max Number program using no parametarized constructor with return type with parametarized method
118 . Write a Java-program to print Max Number program using no parametarized constructor with no return type with no parametarized method
119 . Write a Java-program to print Max Number program using parametarized constructor with no return type with parametarized method
120 . Write a Java-program to print Max Number program using parametarized constructor with return type with no parametarized method
121 . Write a Java-program to print Max Number program using parametarized constructor with return type with parametarized method
122 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with no parametarized method
123 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with parametarized method
124 . Write a Java-program to print Factorial Number program using no parametarized constructor with return type with no parametarized method
125 . Write a Java-program to print Factorial Number program using no parametarized constructor with return type with parametarized method
126 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with no parametarized method
127 . Write a Java-program to print Factorial Number program using parametarized constructor with no return type with parametarized method