Answer to Question #224069 in Java | JSP | JSF for Kavin

Question #224069

Write a java program to demonstrate static keyword. The program consist three

method with parameters and also use the display method to show the output of

program.


1
Expert's answer
2021-08-09T02:34:41-0400
public class StaticKeyword {


    private static int first;
    public static int add(int x, int y){
        return x +y;
    }
    public static int sub(int x, int y){
        return x - y;
    }
    public static  int mul(int x, int y){
        return x * y;
    }
    public void display(int x, int y){
        System.out.printf("The addition of the two number is %d\nThe subtraction of the two number is"
                + "  %d\n The multiplication of this two number is %d\n", add(x,y),sub(x,y), mul(x,y));
    }
    public static void main(String[] args) {
        StaticKeyword key = new StaticKeyword();
        key.display(20,5);
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS