Skip to content

Commit 3626e7e

Browse files
committed
Migrate development environment from Windows to macOS and continue project updates
- Shifted primary development environment from Windows to macOS to ensure better performance, stability, and streamlined workflow for Java development. - Removed OS-specific metadata and ensured platform-agnostic project compatibility. - Normalized line endings to LF for cross-platform consistency. - Verified and adjusted file paths, permissions, and encoding settings to suit macOS environment. - Cleaned up unnecessary Windows-generated files and updated Git configuration accordingly. - Future commits and development will now be managed entirely from macOS. This migration ensures a cleaner, more consistent setup moving forward and prepares the project for scalable development across Unix-based systems. Future development will continue on macOS for a smoother, Unix-based experience. Signed-off-by: Someshdiwan <[email protected]>
1 parent 77151aa commit 3626e7e

21 files changed

+492
-9
lines changed

Section9ArrayAB/Array 2.0/Array 2.0.iml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,5 @@
77
</content>
88
<orderEntry type="inheritedJdk" />
99
<orderEntry type="sourceFolder" forTests="false" />
10-
<orderEntry type="module-library" exported="">
11-
<library>
12-
<CLASSES>
13-
<root url="jar://$MODULE_DIR$/../../../../sqlite-jdbc-3.34.0.jar!/" />
14-
</CLASSES>
15-
<JAVADOC />
16-
<SOURCES />
17-
</library>
18-
</orderEntry>
1910
</component>
2011
</module>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class Arrays
2+
{
3+
public static void main(String[] args)
4+
{
5+
//week days
6+
String[] weekDays = new String[7];
7+
weekDays[0] = "Monday ";
8+
weekDays[1] = "Tuesday ";
9+
weekDays[2] = "Wednesday ";
10+
weekDays[3] = "Thursday ";
11+
weekDays[4] = "Friday ";
12+
weekDays[5] = "Saturday ";
13+
weekDays[6] = "Sunday ";
14+
15+
//prime numbers
16+
int[] primes = {2, 3, 5, 7, 11, 13, 17};
17+
18+
//the way to print an array in Java is to loop through it
19+
for (int i=0; i<7; i++)
20+
{
21+
System.out.print(weekDays[i]);
22+
System.out.println(primes[i]);
23+
}
24+
25+
}
26+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
public class Arrays2D
2+
{
3+
public static void main(String[] args)
4+
{
5+
//Create a 2D array of Strings, with 3 rows and 4 columns
6+
String[][] letters = new String[3][4];
7+
letters[0] = new String[]{"a", "b", "c", "d", "e"};
8+
letters[1] = new String[]{"f", "g", "h", "i", "j"};
9+
letters[2] = new String[]{"k", "l", "m", "n", "o"};
10+
11+
//Enhanced for loop where every iteration, row is a 1D array of Strings.
12+
for (String[] row: letters)
13+
{
14+
//Enhanced for loop where letter is each element of the current row.
15+
for (String letter: row)
16+
{
17+
System.out.print(letter);
18+
}
19+
System.out.println();
20+
}
21+
22+
int[][] numbers = {{1,2}, {3,4}, {5,6}, {7,8}};
23+
for (int y=0; y < numbers.length; y++)
24+
{
25+
for (int x = 0; x < numbers[0].length; x++)
26+
{
27+
System.out.print(numbers[y][x]);
28+
}
29+
System.out.println();
30+
}
31+
}
32+
}
639 KB
Loading
351 KB
Loading

Section9ArrayAB/Array IMP/A2D.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.util.Scanner;
2+
3+
class A2D
4+
{
5+
public static void main(String[] args)
6+
{
7+
int [][] A = new int [2][2];
8+
Scanner sc = new Scanner(System.in);
9+
System.out.println("Enter the elements: ");
10+
for(int i = 0; i<2; i++)
11+
{
12+
for(int j = 0; j<2; j++)
13+
{
14+
A[i][j] = nextInt[];
15+
}
16+
}
17+
18+
System.out.println("Array elements are: ");
19+
for(int i = 0; i<2; i++)
20+
{
21+
for (int j = 0; j<2; j++)
22+
{
23+
System.out.print(A[i][j]+" ");
24+
}
25+
}
26+
27+
System.out.println("");
28+
}
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
class Array2D
3+
{
4+
public static void main(String [] args)
5+
{
6+
int [][] A=new int [2][2];
7+
Scanner sc = new Scanner(System.in);
8+
System.out.println("enter 4 elements");
9+
for(int i=0; i<2; i++)
10+
{
11+
for(int j=0; j<2; j++)
12+
{
13+
A[i][j] = sc.nextInt();
14+
}
15+
}
16+
System.out.println("Array elements are");
17+
for(int i=0; i<2; i++)
18+
{
19+
for(int j=0; j<2; j++)
20+
{
21+
System.out.println(A[i][j] + " "+ A[i][j]);
22+
}
23+
System.out.println(" ");
24+
}
25+
}
26+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.util.Scanner;
2+
3+
class ArrayAdd {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
int[] A = new int[5];
7+
int[] B = new int[5];
8+
int[] C = new int[5];
9+
10+
System.out.println("Enter array elements A:");
11+
for (int i = 0; i < A.length; i++) {
12+
A[i] = sc.nextInt();
13+
}
14+
15+
System.out.println("Enter array elements B:");
16+
for (int i = 0; i < B.length; i++) {
17+
B[i] = sc.nextInt();
18+
}
19+
20+
// Add arrays A and B, store result in C
21+
for (int i = 0; i < A.length; i++) {
22+
C[i] = A[i] + B[i];
23+
}
24+
25+
// Print result
26+
System.out.println("Sum of arrays:");
27+
for (int i = 0; i < C.length; i++) {
28+
System.out.print(C[i] + " ");
29+
}
30+
}
31+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import java.util.ArrayList;
2+
import java.util.Scanner;
3+
4+
public class ArrayListExample {
5+
public static void main(String[] args) {
6+
Scanner in = new Scanner(System.in);
7+
// Syntax
8+
ArrayList<Integer> list = new ArrayList<>(5);
9+
10+
// list.add(67);
11+
// list.add(234);
12+
// list.add(654);
13+
// list.add(43);
14+
// list.add(654);
15+
// list.add(8765);
16+
17+
// System.out.println(list.contains(765432));
18+
// System.out.println(list);
19+
// list.set(0, 99);
20+
//
21+
// list.remove(2);
22+
//
23+
// System.out.println(list);
24+
25+
// input
26+
for (int i = 0; i < 5; i++) {
27+
list.add(in.nextInt());
28+
}
29+
30+
// get item at any index
31+
for (int i = 0; i < 5; i++) {
32+
System.out.println(list.get(i)); // pass index here, list[index] syntax will not work here
33+
}
34+
35+
System.out.println(list);
36+
37+
38+
39+
}
40+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import java.util.Scanner;
2+
3+
class ArraySum
4+
{
5+
public static void main(String[] args)
6+
{
7+
int n, sum = 0;
8+
Scanner sc = new Scanner(System.in);
9+
10+
System.out.println("Enter Size of an Array");
11+
12+
n = sc.nextInt();
13+
14+
int [] A = new int[n];
15+
16+
System.out.println("Enter Array Elements: ");
17+
18+
for(int i = 0; i<A.length; i++)
19+
{
20+
A[i] = sc.nextInt();
21+
}
22+
23+
System.out.println("Array elements are: ");
24+
25+
for(int i = 0; i<A.length; i++)
26+
{
27+
System.out.println(A[i]);
28+
}
29+
30+
System.out.println("Sum of Array Elements are: ");
31+
32+
for(int i = 0; i<A.length; i++)
33+
{
34+
sum = sum + A[i];
35+
}
36+
System.out.println(sum);
37+
}
38+
}

0 commit comments

Comments
 (0)