Advertisement
vencinachev

Untitled

Oct 1st, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.    
  5.     public static void main(String[] args) {
  6.         /*отлична оценка или не
  7.         Scanner scan = new Scanner(System.in); 
  8.         System.out.print("Enter grade !");
  9.         double grade = scan.nextDouble();
  10.        
  11.         if(grade >= 5.5) {
  12.             System.out.print("Excellent !");
  13.         }else {
  14.             System.out.print("Not Excellent !");
  15.         }
  16.         */
  17.        
  18.         /* четно или нечетно
  19.         Scanner scan = new Scanner(System.in);
  20.         int number = scan.nextInt();
  21.        
  22.         if(number % 2 == 0) {
  23.             System.out.print("Even");
  24.         }else {
  25.             System.out.print("Odd");
  26.         }
  27.         */
  28.        
  29.         /* еднакви думи
  30.         Scanner scan = new Scanner(System.in);
  31.         String text1 = scan.next().toUpperCase();
  32.         String text2 = scan.next().toUpperCase();
  33.        
  34.         if(text1.equals(text2)) {
  35.             System.out.print("yes");
  36.         }else {
  37.             System.out.print("no");
  38.         }
  39.         */
  40.        
  41.         String firstName = "Ivan";
  42.         String lastName = "Ivanov";
  43.         int age = 15;
  44.         String fullName = firstName + " " + lastName + " " + age + "!";
  45.        
  46.    
  47.         int length = fullName.length();
  48.         char fistSymbol = fullName.charAt(0);
  49.         char lastSymbol = fullName.charAt(length - 1);
  50.        
  51.         System.out.println(fullName);
  52.         System.out.println(length);
  53.         System.out.println(fistSymbol);
  54.         System.out.println(lastSymbol);
  55.        
  56.        
  57.          
  58.        
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement