Skip to content

Commit

Permalink
add method code
Browse files Browse the repository at this point in the history
  • Loading branch information
mdyasinahmed committed Sep 11, 2023
1 parent b3344ff commit 9cfb62f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions oop_practice/src/main/java/method/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package method;

class Main {

// create a method
public int divideNumbers(int x, int y) {
int division = x / y;
// return value
return division;
}

public static void main(String[] args) {

int firstNumber = 4;
int secondNumber = 2;

// create an object of Main
Main obj = new Main();
// calling method
int result = obj.divideNumbers(firstNumber, secondNumber);
System.out.println("Dividing " + firstNumber + " by " + secondNumber + " is: " + result);
}
}

0 comments on commit 9cfb62f

Please sign in to comment.