From 8caaee14922d9049025cf60776f8557161e1afa7 Mon Sep 17 00:00:00 2001 From: Sergey Iryupin Date: Sat, 25 May 2024 09:56:58 +0200 Subject: [PATCH] java basic lesson #5 --- BerlinTelran/JavaBasic/JavaBasic5Lesson.java | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 BerlinTelran/JavaBasic/JavaBasic5Lesson.java diff --git a/BerlinTelran/JavaBasic/JavaBasic5Lesson.java b/BerlinTelran/JavaBasic/JavaBasic5Lesson.java new file mode 100644 index 00000000..cc4f70b9 --- /dev/null +++ b/BerlinTelran/JavaBasic/JavaBasic5Lesson.java @@ -0,0 +1,23 @@ +import java.util.Random; +import java.util.Scanner; + +class JavaBasic5Lesson { + public static void main(String[] args) { + String str = new String("Hello,"); + String strJava = " Java!"; + String strResult = str.concat(strJava); + System.out.println(strResult); + System.out.println(strResult.contains("abc")); + System.out.println(strResult.indexOf("Java")); + System.out.println(str.equalsIgnoreCase("hello,")); + System.out.println(strResult.length()); + System.out.println(strResult.substring(7, 11)); + System.out.println(strResult.toUpperCase()); + strResult += " Hi!"; + System.out.println(strResult); + for (int i = 0; i < str.length(); i++) { + System.out.print(str.charAt(i) + "-"); + } + System.out.println(Math.PI); + } +} \ No newline at end of file