Skip to content

Commit 482c747

Browse files
committed
added - new classes
1 parent 1b19c89 commit 482c747

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

src/CallingMethodsInSameClass.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Created by mrugesh patel on 4/11/17.
3+
*/
4+
public class CallingMethodsInSameClass {
5+
// Method definition performing a Call to another Method
6+
public static void main(String[] args) {
7+
Method1(); // Method being called.
8+
Method2(); // Method being called.
9+
}
10+
11+
// Method definition to call in another Method
12+
13+
public static void Method1() {
14+
System.out.println("Hello World! Mrugesh!!");
15+
}
16+
17+
// Method definition performing a Call to another Method
18+
public static void Method2() {
19+
Method1(); // Method being called.
20+
}
21+
}
22+

src/JavaInvertTriangle.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Created by mrugesh patel on 4/11/17.
3+
*/
4+
public class JavaInvertTriangle {
5+
public static void main(String args[]) {
6+
int num = 9;
7+
while (num > 0) {
8+
for (int i = 1; i <= num; i++) {
9+
System.out.print(" " + num + " ");
10+
}
11+
System.out.print("\n");
12+
num--;
13+
}
14+
}
15+
}

src/PrimeNumbers.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Created by mrugesh patel on 4/11/17.
3+
*/
4+
public class PrimeNumbers {
5+
public static void main(String[] args) {
6+
7+
int num = 20, count;
8+
9+
for (int i = 1; i <= num; i++) {
10+
count = 0;
11+
for (int j = 2; j <= i / 2; j++) {
12+
if (i % j == 0) {
13+
count++;
14+
break;
15+
}
16+
}
17+
18+
if (count == 0) {
19+
System.out.println(i);
20+
}
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)