zoukankan      html  css  js  c++  java
  • 第十三周上机练习

    1.

    package text;
    import java.util.Arrays;
    import java.util.Random;
    import java.util.Scanner;
    public class Zuoyee {
        public static void main(String[] args) {
            int arr[] = new int[11];
              Random r = new Random();
              for (int i = 0; i < 10; i++) 
              {
               System.out.println(r.nextInt(100) + 1);
              }
        }
    }

    2.

    package text;
    import java.text.*;
    import java.util.*;
    public class Text2 {
        public static void main(String[] args) throws Exception {
            SimpleDateFormat sdf=new SimpleDateFormat("Gyyyy年MM月dd日:今天是yyyy年的第D天,E");
            System.out.println(sdf.format(new Date()));
        }
    
    }

    3.

    package text;
    import java.util.Scanner;
    public class LH {
        public static void main(String[] args) {
            Scanner input=new Scanner(System.in);
            System.out.println("请输入邮箱:");
            String a=input.next();
            if(a.contains("@") ==true||a.contains(".") ==true) {
                int a1=a.indexOf("@");
                int a2=a.indexOf(".");
               if (a1<a2){
                   String substring = a.substring(0, a1);
                   System.out.println(substring);
               }else{
                   System.out.println("邮箱不合法");
               }
            }else {
                System.out.println("邮箱不合法");
            }
            
        }
    
    }
  • 相关阅读:
    动态传参
    函数的介绍
    文件的操作
    send email with formatted table
    minimize and close window with customed winform
    python algorithm
    something important about docker
    book list
    which language is suitable for what to do
    Find Duplicate Items in list fast
  • 原文地址:https://www.cnblogs.com/z118127/p/12980470.html
Copyright © 2011-2022 走看看