diff --git a/src/Lab3.java b/src/Lab3.java index 4d5c3f1..06a3881 100644 --- a/src/Lab3.java +++ b/src/Lab3.java @@ -1,10 +1,47 @@ public class Lab3 { + private static final int REPETITION_NUMBER = 10; 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"; StringBuilder stringBuilder = new StringBuilder("ASD"); + StringBuffer stringBuffer = new StringBuffer("ASD"); 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; System.out.println("s2 = " + s2);