zoukankan      html  css  js  c++  java
  • 上机作业5.28

    package yidong;
    
    import java.util.Random;
    
    public class Text {
    
    	public static void main(String[] args) {
    		int a[] = new int[10];
    		Random r = new Random();
    		for (int i = 0; i < a.length; i++) {
    			a[i] = r.nextInt(100);
    		}
    		for (int i = 0; i < a.length; i++) {
    			System.out.println(a[i]);
    		}
    	}
    
    }
    

      

    package yidong;
    
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    public class Text {
    	public static void main(String[] args) {
    		Date c = new Date();
    		SimpleDateFormat a1 = new SimpleDateFormat("Eyyyy年MM月dd日");
    		SimpleDateFormat a2 = new SimpleDateFormat("今天是Eyyyy年的第 D 天 ,E");
    		System.out.println(a1.format(c));
    		System.out.println(a2.format(c));
    
    	}
    }
    

      

    package yidong;
    import java.util.Scanner;
    public class Text {
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            System.out.print("请输入合法的邮箱:");
            String s = input.nextLine();
            int a = 0;
            int b = 0;
            int x = 0;
            int y = 0;
            for (int i= 0; i < s.length() - 1; i++) {
                String str = s.substring(i, i + 1);
                if (str.equals("@")) {
                    a++;
                    x = i;
                }
                if (str.equals(".")) {
                   b++;
                    y = i;
                }
            }
            if (a == 1 &&b == 1 && x < (y - 1) && x != 0 && y != s.length() - 1) {
               s.endsWith("@qq.com");
                System.out.println("合法");
            } else {
                System.out.println("不合法");
            }
            String s1 = s.substring(0, s.indexOf("@"));
    		System.out.println("用户名是:"+s1);
        }
    }
    

      

  • 相关阅读:
    R语言在最后一行追加字符
    linux系统中将每行特定数目字符后的字符替换为指定字符
    设定到那个层级上
    uv 一些常用
    编辑控件
    渲染点显示的 帮助
    直线y=x
    dotNetControl PictrueBox
    控件表
    颜色的东西
  • 原文地址:https://www.cnblogs.com/hzpiou/p/12979207.html
Copyright © 2011-2022 走看看