Advertisement
sergAccount

Untitled

Dec 19th, 2020
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package ja12;
  7.  
  8. /**
  9.  *
  10.  * @author Administrator
  11.  */
  12. public class JA12 {
  13.  
  14.     public static void main(String[] args) {
  15.         // TODO code application logic here
  16.         String s = "JAAAAAAAAAB ADADD";
  17.         String res = s + "!!!!";
  18.         System.out.println(res);
  19.         // метод charAt - позволяет получить по индексу определенный символ
  20.         char ch1 = s.charAt(0);
  21.         System.out.println("ch1=" + ch1);
  22.         // метод для получения длины строки
  23.         int len = s.length();
  24.         System.out.println("len=" + len);
  25.         //
  26.         String substring = s.substring(0, 3);
  27.         System.out.println("substring=" + substring);
  28.     }
  29.    
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement