Compare commits
No commits in common. "9b871b6a42505bb3e7ce21f0537ad7dd79c66908" and "455c991edbe1c376cd9c6fdea80c12d469df5c0d" have entirely different histories.
9b871b6a42
...
455c991edb
|
@ -1,47 +1,10 @@
|
||||||
public class Lab3 {
|
public class Lab3 {
|
||||||
private static final int REPETITION_NUMBER = 10;
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
for (int i = 0; i < REPETITION_NUMBER; i++) {
|
|
||||||
// result += Integer.toString(i);
|
|
||||||
// result += String.valueOf(i);
|
|
||||||
result.append(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*float f = 1.1f;
|
|
||||||
double d = 2.2;
|
|
||||||
// f = (float) (f + d);
|
|
||||||
f += d;*/
|
|
||||||
|
|
||||||
String s = "ASD";
|
String s = "ASD";
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("ASD");
|
StringBuilder stringBuilder = new StringBuilder("ASD");
|
||||||
StringBuffer stringBuffer = new StringBuffer("ASD");
|
|
||||||
|
|
||||||
stringBuilder.append("A");
|
stringBuilder.append("A");
|
||||||
System.out.println(s.length());
|
|
||||||
System.out.println(stringBuilder.length());
|
|
||||||
System.out.println(stringBuffer.length());
|
|
||||||
|
|
||||||
System.out.println(s.endsWith("D"));
|
|
||||||
// System.out.println(stringBuilder.substring(stringBuilder.length() - 1).equals("A"));
|
|
||||||
System.out.println("A".equals(stringBuilder.substring(stringBuilder.length() - 1)));
|
|
||||||
System.out.println("A".equals(stringBuffer.substring(stringBuffer.length() - 1)));
|
|
||||||
|
|
||||||
String sNull = null;
|
|
||||||
System.out.println("A".equals(sNull));
|
|
||||||
System.out.println(sNull.equals("A"));
|
|
||||||
|
|
||||||
System.out.println(s.substring(2));
|
|
||||||
System.out.println(s.contains("AS"));
|
|
||||||
|
|
||||||
System.out.println(s.indexOf('a'));
|
|
||||||
|
|
||||||
// System.out.println(s.charAt(-1));
|
|
||||||
|
|
||||||
System.out.println("s.equalsIgnoreCase(\"AsD\") = " + s.equalsIgnoreCase("AsD"));
|
|
||||||
|
|
||||||
String s2 = s;
|
String s2 = s;
|
||||||
System.out.println("s2 = " + s2);
|
System.out.println("s2 = " + s2);
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package test.one;
|
|
||||||
|
|
||||||
public class A implements MyMethodInterface {
|
|
||||||
public void myMethod() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package test.one;
|
|
||||||
|
|
||||||
public class B implements MyMethodInterface {
|
|
||||||
public void myMethod() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package test.one;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Object[] objects = {
|
|
||||||
new A(),
|
|
||||||
new B(),
|
|
||||||
};
|
|
||||||
for (Object object : objects) {
|
|
||||||
((MyMethodInterface)object).myMethod();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package test.one;
|
|
||||||
|
|
||||||
public interface MyMethodInterface {
|
|
||||||
void myMethod();
|
|
||||||
}
|
|
Loading…
Reference in New Issue