File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed
Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments