Skip to content

Commit

Permalink
Writing first Java class using IntelliJ
Browse files Browse the repository at this point in the history
  • Loading branch information
eazybytes committed Sep 21, 2024
1 parent fe70d48 commit 4e29d5a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions section3/HelloWorld/src/Demo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
public class Demo {

public static void main(String[] args) {
System.out.println("Hello Madan");
}


/**
* Adds two numbers
* @param a the first number
* @param b the second number
* @return the sum of the two numbers
*/
public static int add(int a, int b) {
System.out.println("Sum: " + (a+b));
return a + b;
}

/**
* Subtracts two numbers
* @param a the first number
* @param b the second number
* @return the difference of the two numbers
*/
public static int subtract(int a, int b) {
System.out.println("Difference: " + (a-b));
return a - b;
}

/**
* Multiplies two numbers
* @param a the first number
* @param b the second number
* @return the product of the two numbers
*/
public static int multiply(int a, int b) {
System.out.println("Product: " + (a*b));
return a * b;
}

/**
* Divides two numbers
* @param a the first number
* @param b the second number
* @return the quotient of the two numbers
*/
public static double divide(int a, int b) {
System.out.println("Quotient: " + (a/b));
return (double)a / b;
}


}

0 comments on commit 4e29d5a

Please sign in to comment.