Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.app10;
- /**
- *
- * @author Admin
- */
- public class Test {
- public static void main(String[] args) {
- // char
- char c = 'A';
- System.out.println(c);
- // тип String
- String s;
- System.out.println("HELLO JAVA!");
- s = "HELLO JAVA dsfds gfdsf dsf dsf sdf dsfdf dsfds !";
- String s1 = "JDDKDKD";
- //
- String s3 = s;
- System.out.println(s3);
- String a = "HELLO!!!!F";
- String b = "JAVA";
- String res = a + b + "!" + "fsdfdsf " + "asfasfasf !!!!";
- System.out.println(res);
- // используем метод length() - получаем длину строки (количесво симовлов строки)
- System.out.println(a.length());
- System.out.println(b.length());
- // получаем символ из строки
- char c1 = a.charAt(0);
- System.out.println(c1);
- // получаем последний символ из строки
- char c2 = a.charAt(a.length()-1);
- System.out.println(c2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement