Compare commits

...

3 Commits

Author SHA1 Message Date
Oleksii Aleshchenko 4531049ff2 add lab3 2023-04-06 16:07:04 +03:00
Oleksii Aleshchenko 07b17ca3cc upd lab2 (remove todo) 2023-04-06 15:34:29 +03:00
Oleksii Aleshchenko a61c59bf48 upd lab2 2023-04-06 15:34:03 +03:00
2 changed files with 34 additions and 1 deletions

View File

@ -95,16 +95,23 @@ public class Lab2 {
// System.exit(0);
}
}
// todo check repetition of minimal elements
int sum = 0;
for (int j = 0; j < MATRIX_C[0].length; j++) {
int tmpSmallest = MATRIX_C[0][j];
boolean valueRepeats = false;
for (int i = 1; i < MATRIX_C.length; i++) {
if (MATRIX_C[i][j] < tmpSmallest) {
tmpSmallest = MATRIX_C[i][j];
valueRepeats = false;
} else if (MATRIX_C[i][j] == tmpSmallest) {
valueRepeats = true;
}
}
sum += tmpSmallest;
if (!valueRepeats) {
sum += tmpSmallest;
}
}
return sum;
}

26
src/Lab3.java Normal file
View File

@ -0,0 +1,26 @@
public class Lab3 {
public static void main(String[] args) {
String s = "ASD";
String s2 = s;
System.out.println("s2 = " + s2);
System.out.println(s == s2); // true?
System.out.println(s.equals(s2)); // true?
s += "B";
System.out.println(s);
System.out.println("s2 = " + s2);
System.out.println(s == s2); // false?
System.out.println(s.equals(s2)); // false?
String s3 = new String("ASD");
System.out.println(s3 == s2); // true? (false)
System.out.println(s3.equals(s2)); // false? (true)
// String Pool
String s4 = "ASD";
System.out.println(s4 == s2); // true?
System.out.println(s4.equals(s2)); // (true)
System.out.println("Done!");
}
}